<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - id:000977,sync:fuzzer2,src:001052.lcov_info_final - test/gmock-1.7.0/gtest/include/gtest/gtest.h</title>
  <link rel="stylesheet" type="text/css" href="../../../../../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../../../../../index.html">top level</a> - <a href="index.html">test/gmock-1.7.0/gtest/include/gtest</a> - gtest.h<span style="font-size: 80%;"> (source / <a href="gtest.h.func-sort-c.html">functions</a>)</span></td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">id:000977,sync:fuzzer2,src:001052.lcov_info_final</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">125</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2016-03-13 10:42:47</td>
            <td></td>
            <td class="headerItem">Functions:</td>
            <td class="headerCovTableEntry">0</td>
            <td class="headerCovTableEntry">365</td>
            <td class="headerCovTableEntryLo">0.0 %</td>
          </tr>
          <tr><td><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<a name="1"><span class="lineNum">       1 </span>            : // Copyright 2005, Google Inc.</a>
<span class="lineNum">       2 </span>            : // All rights reserved.
<span class="lineNum">       3 </span>            : //
<span class="lineNum">       4 </span>            : // Redistribution and use in source and binary forms, with or without
<span class="lineNum">       5 </span>            : // modification, are permitted provided that the following conditions are
<span class="lineNum">       6 </span>            : // met:
<span class="lineNum">       7 </span>            : //
<span class="lineNum">       8 </span>            : //     * Redistributions of source code must retain the above copyright
<span class="lineNum">       9 </span>            : // notice, this list of conditions and the following disclaimer.
<span class="lineNum">      10 </span>            : //     * Redistributions in binary form must reproduce the above
<span class="lineNum">      11 </span>            : // copyright notice, this list of conditions and the following disclaimer
<span class="lineNum">      12 </span>            : // in the documentation and/or other materials provided with the
<span class="lineNum">      13 </span>            : // distribution.
<span class="lineNum">      14 </span>            : //     * Neither the name of Google Inc. nor the names of its
<span class="lineNum">      15 </span>            : // contributors may be used to endorse or promote products derived from
<span class="lineNum">      16 </span>            : // this software without specific prior written permission.
<span class="lineNum">      17 </span>            : //
<span class="lineNum">      18 </span>            : // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
<span class="lineNum">      19 </span>            : // &quot;AS IS&quot; AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
<span class="lineNum">      20 </span>            : // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
<span class="lineNum">      21 </span>            : // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
<span class="lineNum">      22 </span>            : // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
<span class="lineNum">      23 </span>            : // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
<span class="lineNum">      24 </span>            : // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
<span class="lineNum">      25 </span>            : // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
<span class="lineNum">      26 </span>            : // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
<span class="lineNum">      27 </span>            : // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
<span class="lineNum">      28 </span>            : // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
<span class="lineNum">      29 </span>            : //
<span class="lineNum">      30 </span>            : // Author: wan@google.com (Zhanyong Wan)
<span class="lineNum">      31 </span>            : //
<span class="lineNum">      32 </span>            : // The Google C++ Testing Framework (Google Test)
<span class="lineNum">      33 </span>            : //
<span class="lineNum">      34 </span>            : // This header file defines the public API for Google Test.  It should be
<span class="lineNum">      35 </span>            : // included by any test program that uses Google Test.
<span class="lineNum">      36 </span>            : //
<span class="lineNum">      37 </span>            : // IMPORTANT NOTE: Due to limitation of the C++ language, we have to
<span class="lineNum">      38 </span>            : // leave some internal implementation details in this header file.
<span class="lineNum">      39 </span>            : // They are clearly marked by comments like this:
<span class="lineNum">      40 </span>            : //
<span class="lineNum">      41 </span>            : //   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">      42 </span>            : //
<span class="lineNum">      43 </span>            : // Such code is NOT meant to be used by a user directly, and is subject
<span class="lineNum">      44 </span>            : // to CHANGE WITHOUT NOTICE.  Therefore DO NOT DEPEND ON IT in a user
<span class="lineNum">      45 </span>            : // program!
<span class="lineNum">      46 </span>            : //
<span class="lineNum">      47 </span>            : // Acknowledgment: Google Test borrowed the idea of automatic test
<span class="lineNum">      48 </span>            : // registration from Barthelemy Dagenais' (barthelemy@prologique.com)
<span class="lineNum">      49 </span>            : // easyUnit framework.
<span class="lineNum">      50 </span>            : 
<span class="lineNum">      51 </span>            : #ifndef GTEST_INCLUDE_GTEST_GTEST_H_
<span class="lineNum">      52 </span>            : #define GTEST_INCLUDE_GTEST_GTEST_H_
<span class="lineNum">      53 </span>            : 
<span class="lineNum">      54 </span>            : #include &lt;limits&gt;
<span class="lineNum">      55 </span>            : #include &lt;ostream&gt;
<span class="lineNum">      56 </span>            : #include &lt;vector&gt;
<span class="lineNum">      57 </span>            : 
<span class="lineNum">      58 </span>            : #include &quot;gtest/internal/gtest-internal.h&quot;
<span class="lineNum">      59 </span>            : #include &quot;gtest/internal/gtest-string.h&quot;
<span class="lineNum">      60 </span>            : #include &quot;gtest/gtest-death-test.h&quot;
<span class="lineNum">      61 </span>            : #include &quot;gtest/gtest-message.h&quot;
<span class="lineNum">      62 </span>            : #include &quot;gtest/gtest-param-test.h&quot;
<span class="lineNum">      63 </span>            : #include &quot;gtest/gtest-printers.h&quot;
<span class="lineNum">      64 </span>            : #include &quot;gtest/gtest_prod.h&quot;
<span class="lineNum">      65 </span>            : #include &quot;gtest/gtest-test-part.h&quot;
<span class="lineNum">      66 </span>            : #include &quot;gtest/gtest-typed-test.h&quot;
<span class="lineNum">      67 </span>            : 
<span class="lineNum">      68 </span>            : // Depending on the platform, different string classes are available.
<span class="lineNum">      69 </span>            : // On Linux, in addition to ::std::string, Google also makes use of
<span class="lineNum">      70 </span>            : // class ::string, which has the same interface as ::std::string, but
<span class="lineNum">      71 </span>            : // has a different implementation.
<span class="lineNum">      72 </span>            : //
<span class="lineNum">      73 </span>            : // The user can define GTEST_HAS_GLOBAL_STRING to 1 to indicate that
<span class="lineNum">      74 </span>            : // ::string is available AND is a distinct type to ::std::string, or
<span class="lineNum">      75 </span>            : // define it to 0 to indicate otherwise.
<span class="lineNum">      76 </span>            : //
<span class="lineNum">      77 </span>            : // If the user's ::std::string and ::string are the same class due to
<span class="lineNum">      78 </span>            : // aliasing, he should define GTEST_HAS_GLOBAL_STRING to 0.
<span class="lineNum">      79 </span>            : //
<span class="lineNum">      80 </span>            : // If the user doesn't define GTEST_HAS_GLOBAL_STRING, it is defined
<span class="lineNum">      81 </span>            : // heuristically.
<span class="lineNum">      82 </span>            : 
<span class="lineNum">      83 </span>            : namespace testing {
<span class="lineNum">      84 </span>            : 
<span class="lineNum">      85 </span>            : // Declares the flags.
<span class="lineNum">      86 </span>            : 
<span class="lineNum">      87 </span>            : // This flag temporary enables the disabled tests.
<span class="lineNum">      88 </span>            : GTEST_DECLARE_bool_(also_run_disabled_tests);
<span class="lineNum">      89 </span>            : 
<span class="lineNum">      90 </span>            : // This flag brings the debugger on an assertion failure.
<span class="lineNum">      91 </span>            : GTEST_DECLARE_bool_(break_on_failure);
<span class="lineNum">      92 </span>            : 
<span class="lineNum">      93 </span>            : // This flag controls whether Google Test catches all test-thrown exceptions
<span class="lineNum">      94 </span>            : // and logs them as failures.
<span class="lineNum">      95 </span>            : GTEST_DECLARE_bool_(catch_exceptions);
<span class="lineNum">      96 </span>            : 
<span class="lineNum">      97 </span>            : // This flag enables using colors in terminal output. Available values are
<span class="lineNum">      98 </span>            : // &quot;yes&quot; to enable colors, &quot;no&quot; (disable colors), or &quot;auto&quot; (the default)
<span class="lineNum">      99 </span>            : // to let Google Test decide.
<span class="lineNum">     100 </span>            : GTEST_DECLARE_string_(color);
<span class="lineNum">     101 </span>            : 
<span class="lineNum">     102 </span>            : // This flag sets up the filter to select by name using a glob pattern
<span class="lineNum">     103 </span>            : // the tests to run. If the filter is not given all tests are executed.
<span class="lineNum">     104 </span>            : GTEST_DECLARE_string_(filter);
<span class="lineNum">     105 </span>            : 
<span class="lineNum">     106 </span>            : // This flag causes the Google Test to list tests. None of the tests listed
<span class="lineNum">     107 </span>            : // are actually run if the flag is provided.
<span class="lineNum">     108 </span>            : GTEST_DECLARE_bool_(list_tests);
<span class="lineNum">     109 </span>            : 
<span class="lineNum">     110 </span>            : // This flag controls whether Google Test emits a detailed XML report to a file
<span class="lineNum">     111 </span>            : // in addition to its normal textual output.
<span class="lineNum">     112 </span>            : GTEST_DECLARE_string_(output);
<span class="lineNum">     113 </span>            : 
<span class="lineNum">     114 </span>            : // This flags control whether Google Test prints the elapsed time for each
<span class="lineNum">     115 </span>            : // test.
<span class="lineNum">     116 </span>            : GTEST_DECLARE_bool_(print_time);
<span class="lineNum">     117 </span>            : 
<span class="lineNum">     118 </span>            : // This flag specifies the random number seed.
<span class="lineNum">     119 </span>            : GTEST_DECLARE_int32_(random_seed);
<span class="lineNum">     120 </span>            : 
<span class="lineNum">     121 </span>            : // This flag sets how many times the tests are repeated. The default value
<span class="lineNum">     122 </span>            : // is 1. If the value is -1 the tests are repeating forever.
<span class="lineNum">     123 </span>            : GTEST_DECLARE_int32_(repeat);
<span class="lineNum">     124 </span>            : 
<span class="lineNum">     125 </span>            : // This flag controls whether Google Test includes Google Test internal
<span class="lineNum">     126 </span>            : // stack frames in failure stack traces.
<span class="lineNum">     127 </span>            : GTEST_DECLARE_bool_(show_internal_stack_frames);
<span class="lineNum">     128 </span>            : 
<span class="lineNum">     129 </span>            : // When this flag is specified, tests' order is randomized on every iteration.
<span class="lineNum">     130 </span>            : GTEST_DECLARE_bool_(shuffle);
<span class="lineNum">     131 </span>            : 
<span class="lineNum">     132 </span>            : // This flag specifies the maximum number of stack frames to be
<span class="lineNum">     133 </span>            : // printed in a failure message.
<span class="lineNum">     134 </span>            : GTEST_DECLARE_int32_(stack_trace_depth);
<span class="lineNum">     135 </span>            : 
<span class="lineNum">     136 </span>            : // When this flag is specified, a failed assertion will throw an
<span class="lineNum">     137 </span>            : // exception if exceptions are enabled, or exit the program with a
<span class="lineNum">     138 </span>            : // non-zero code otherwise.
<span class="lineNum">     139 </span>            : GTEST_DECLARE_bool_(throw_on_failure);
<span class="lineNum">     140 </span>            : 
<span class="lineNum">     141 </span>            : // When this flag is set with a &quot;host:port&quot; string, on supported
<span class="lineNum">     142 </span>            : // platforms test results are streamed to the specified port on
<span class="lineNum">     143 </span>            : // the specified host machine.
<span class="lineNum">     144 </span>            : GTEST_DECLARE_string_(stream_result_to);
<span class="lineNum">     145 </span>            : 
<span class="lineNum">     146 </span>            : // The upper limit for valid stack trace depths.
<span class="lineNum">     147 </span>            : const int kMaxStackTraceDepth = 100;
<span class="lineNum">     148 </span>            : 
<span class="lineNum">     149 </span>            : namespace internal {
<span class="lineNum">     150 </span>            : 
<span class="lineNum">     151 </span>            : class AssertHelper;
<span class="lineNum">     152 </span>            : class DefaultGlobalTestPartResultReporter;
<span class="lineNum">     153 </span>            : class ExecDeathTest;
<span class="lineNum">     154 </span>            : class NoExecDeathTest;
<span class="lineNum">     155 </span>            : class FinalSuccessChecker;
<span class="lineNum">     156 </span>            : class GTestFlagSaver;
<span class="lineNum">     157 </span>            : class StreamingListenerTest;
<span class="lineNum">     158 </span>            : class TestResultAccessor;
<span class="lineNum">     159 </span>            : class TestEventListenersAccessor;
<span class="lineNum">     160 </span>            : class TestEventRepeater;
<span class="lineNum">     161 </span>            : class UnitTestRecordPropertyTestHelper;
<span class="lineNum">     162 </span>            : class WindowsDeathTest;
<span class="lineNum">     163 </span>            : class UnitTestImpl* GetUnitTestImpl();
<span class="lineNum">     164 </span>            : void ReportFailureInUnknownLocation(TestPartResult::Type result_type,
<span class="lineNum">     165 </span>            :                                     const std::string&amp; message);
<span class="lineNum">     166 </span>            : 
<span class="lineNum">     167 </span>            : }  // namespace internal
<span class="lineNum">     168 </span>            : 
<span class="lineNum">     169 </span>            : // The friend relationship of some of these classes is cyclic.
<span class="lineNum">     170 </span>            : // If we don't forward declare them the compiler might confuse the classes
<span class="lineNum">     171 </span>            : // in friendship clauses with same named classes on the scope.
<span class="lineNum">     172 </span>            : class Test;
<span class="lineNum">     173 </span>            : class TestCase;
<span class="lineNum">     174 </span>            : class TestInfo;
<span class="lineNum">     175 </span>            : class UnitTest;
<span class="lineNum">     176 </span>            : 
<span class="lineNum">     177 </span>            : // A class for indicating whether an assertion was successful.  When
<span class="lineNum">     178 </span>            : // the assertion wasn't successful, the AssertionResult object
<span class="lineNum">     179 </span>            : // remembers a non-empty message that describes how it failed.
<span class="lineNum">     180 </span>            : //
<span class="lineNum">     181 </span>            : // To create an instance of this class, use one of the factory functions
<span class="lineNum">     182 </span>            : // (AssertionSuccess() and AssertionFailure()).
<span class="lineNum">     183 </span>            : //
<span class="lineNum">     184 </span>            : // This class is useful for two purposes:
<span class="lineNum">     185 </span>            : //   1. Defining predicate functions to be used with Boolean test assertions
<span class="lineNum">     186 </span>            : //      EXPECT_TRUE/EXPECT_FALSE and their ASSERT_ counterparts
<span class="lineNum">     187 </span>            : //   2. Defining predicate-format functions to be
<span class="lineNum">     188 </span>            : //      used with predicate assertions (ASSERT_PRED_FORMAT*, etc).
<span class="lineNum">     189 </span>            : //
<span class="lineNum">     190 </span>            : // For example, if you define IsEven predicate:
<span class="lineNum">     191 </span>            : //
<span class="lineNum">     192 </span>            : //   testing::AssertionResult IsEven(int n) {
<span class="lineNum">     193 </span>            : //     if ((n % 2) == 0)
<span class="lineNum">     194 </span>            : //       return testing::AssertionSuccess();
<span class="lineNum">     195 </span>            : //     else
<span class="lineNum">     196 </span>            : //       return testing::AssertionFailure() &lt;&lt; n &lt;&lt; &quot; is odd&quot;;
<span class="lineNum">     197 </span>            : //   }
<span class="lineNum">     198 </span>            : //
<span class="lineNum">     199 </span>            : // Then the failed expectation EXPECT_TRUE(IsEven(Fib(5)))
<span class="lineNum">     200 </span>            : // will print the message
<span class="lineNum">     201 </span>            : //
<span class="lineNum">     202 </span>            : //   Value of: IsEven(Fib(5))
<span class="lineNum">     203 </span>            : //     Actual: false (5 is odd)
<span class="lineNum">     204 </span>            : //   Expected: true
<span class="lineNum">     205 </span>            : //
<span class="lineNum">     206 </span>            : // instead of a more opaque
<span class="lineNum">     207 </span>            : //
<span class="lineNum">     208 </span>            : //   Value of: IsEven(Fib(5))
<span class="lineNum">     209 </span>            : //     Actual: false
<span class="lineNum">     210 </span>            : //   Expected: true
<span class="lineNum">     211 </span>            : //
<span class="lineNum">     212 </span>            : // in case IsEven is a simple Boolean predicate.
<span class="lineNum">     213 </span>            : //
<span class="lineNum">     214 </span>            : // If you expect your predicate to be reused and want to support informative
<span class="lineNum">     215 </span>            : // messages in EXPECT_FALSE and ASSERT_FALSE (negative assertions show up
<span class="lineNum">     216 </span>            : // about half as often as positive ones in our tests), supply messages for
<span class="lineNum">     217 </span>            : // both success and failure cases:
<span class="lineNum">     218 </span>            : //
<span class="lineNum">     219 </span>            : //   testing::AssertionResult IsEven(int n) {
<span class="lineNum">     220 </span>            : //     if ((n % 2) == 0)
<span class="lineNum">     221 </span>            : //       return testing::AssertionSuccess() &lt;&lt; n &lt;&lt; &quot; is even&quot;;
<span class="lineNum">     222 </span>            : //     else
<span class="lineNum">     223 </span>            : //       return testing::AssertionFailure() &lt;&lt; n &lt;&lt; &quot; is odd&quot;;
<span class="lineNum">     224 </span>            : //   }
<span class="lineNum">     225 </span>            : //
<span class="lineNum">     226 </span>            : // Then a statement EXPECT_FALSE(IsEven(Fib(6))) will print
<span class="lineNum">     227 </span>            : //
<span class="lineNum">     228 </span>            : //   Value of: IsEven(Fib(6))
<span class="lineNum">     229 </span>            : //     Actual: true (8 is even)
<span class="lineNum">     230 </span>            : //   Expected: false
<span class="lineNum">     231 </span>            : //
<span class="lineNum">     232 </span>            : // NB: Predicates that support negative Boolean assertions have reduced
<span class="lineNum">     233 </span>            : // performance in positive ones so be careful not to use them in tests
<span class="lineNum">     234 </span>            : // that have lots (tens of thousands) of positive Boolean assertions.
<span class="lineNum">     235 </span>            : //
<span class="lineNum">     236 </span>            : // To use this class with EXPECT_PRED_FORMAT assertions such as:
<span class="lineNum">     237 </span>            : //
<span class="lineNum">     238 </span>            : //   // Verifies that Foo() returns an even number.
<span class="lineNum">     239 </span>            : //   EXPECT_PRED_FORMAT1(IsEven, Foo());
<span class="lineNum">     240 </span>            : //
<span class="lineNum">     241 </span>            : // you need to define:
<span class="lineNum">     242 </span>            : //
<span class="lineNum">     243 </span>            : //   testing::AssertionResult IsEven(const char* expr, int n) {
<span class="lineNum">     244 </span>            : //     if ((n % 2) == 0)
<span class="lineNum">     245 </span>            : //       return testing::AssertionSuccess();
<span class="lineNum">     246 </span>            : //     else
<span class="lineNum">     247 </span>            : //       return testing::AssertionFailure()
<span class="lineNum">     248 </span>            : //         &lt;&lt; &quot;Expected: &quot; &lt;&lt; expr &lt;&lt; &quot; is even\n  Actual: it's &quot; &lt;&lt; n;
<span class="lineNum">     249 </span>            : //   }
<span class="lineNum">     250 </span>            : //
<span class="lineNum">     251 </span>            : // If Foo() returns 5, you will see the following message:
<span class="lineNum">     252 </span>            : //
<span class="lineNum">     253 </span>            : //   Expected: Foo() is even
<a name="254"><span class="lineNum">     254 </span>            : //     Actual: it's 5</a>
<span class="lineNum">     255 </span>            : //
<span class="lineNum">     256 </span><span class="lineNoCov">          0 : class GTEST_API_ AssertionResult {</span>
<span class="lineNum">     257 </span>            :  public:
<span class="lineNum">     258 </span>            :   // Copy constructor.
<span class="lineNum">     259 </span>            :   // Used in EXPECT_TRUE/FALSE(assertion_result).
<a name="260"><span class="lineNum">     260 </span>            :   AssertionResult(const AssertionResult&amp; other);</a>
<span class="lineNum">     261 </span>            :   // Used in the EXPECT_TRUE/FALSE(bool_expression).
<span class="lineNum">     262 </span><span class="lineNoCov">          0 :   explicit AssertionResult(bool success) : success_(success) {}</span>
<a name="263"><span class="lineNum">     263 </span>            : </a>
<span class="lineNum">     264 </span>            :   // Returns true iff the assertion succeeded.
<span class="lineNum">     265 </span><span class="lineNoCov">          0 :   operator bool() const { return success_; }  // NOLINT</span>
<span class="lineNum">     266 </span>            : 
<span class="lineNum">     267 </span>            :   // Returns the assertion's negation. Used with EXPECT/ASSERT_FALSE.
<span class="lineNum">     268 </span>            :   AssertionResult operator!() const;
<span class="lineNum">     269 </span>            : 
<span class="lineNum">     270 </span>            :   // Returns the text streamed into this AssertionResult. Test assertions
<span class="lineNum">     271 </span>            :   // use it when they fail (i.e., the predicate's outcome doesn't match the
<a name="272"><span class="lineNum">     272 </span>            :   // assertion's expectation). When nothing has been streamed into the</a>
<span class="lineNum">     273 </span>            :   // object, returns an empty string.
<span class="lineNum">     274 </span><span class="lineNoCov">          0 :   const char* message() const {</span>
<span class="lineNum">     275 </span><span class="lineNoCov">          0 :     return message_.get() != NULL ?  message_-&gt;c_str() : &quot;&quot;;</span>
<span class="lineNum">     276 </span>            :   }
<a name="277"><span class="lineNum">     277 </span>            :   // TODO(vladl@google.com): Remove this after making sure no clients use it.</a>
<span class="lineNum">     278 </span>            :   // Deprecated; please use message() instead.
<span class="lineNum">     279 </span><span class="lineNoCov">          0 :   const char* failure_message() const { return message(); }</span>
<a name="280"><span class="lineNum">     280 </span>            : </a>
<span class="lineNum">     281 </span>            :   // Streams a custom failure message into this object.
<span class="lineNum">     282 </span><span class="lineNoCov">          0 :   template &lt;typename T&gt; AssertionResult&amp; operator&lt;&lt;(const T&amp; value) {</span>
<span class="lineNum">     283 </span><span class="lineNoCov">          0 :     AppendMessage(Message() &lt;&lt; value);</span>
<span class="lineNum">     284 </span><span class="lineNoCov">          0 :     return *this;</span>
<span class="lineNum">     285 </span>            :   }
<span class="lineNum">     286 </span>            : 
<span class="lineNum">     287 </span>            :   // Allows streaming basic output manipulators such as endl or flush into
<span class="lineNum">     288 </span>            :   // this object.
<span class="lineNum">     289 </span>            :   AssertionResult&amp; operator&lt;&lt;(
<span class="lineNum">     290 </span>            :       ::std::ostream&amp; (*basic_manipulator)(::std::ostream&amp; stream)) {
<span class="lineNum">     291 </span>            :     AppendMessage(Message() &lt;&lt; basic_manipulator);
<span class="lineNum">     292 </span>            :     return *this;
<span class="lineNum">     293 </span>            :   }
<span class="lineNum">     294 </span>            : 
<a name="295"><span class="lineNum">     295 </span>            :  private:</a>
<span class="lineNum">     296 </span>            :   // Appends the contents of message to message_.
<span class="lineNum">     297 </span><span class="lineNoCov">          0 :   void AppendMessage(const Message&amp; a_message) {</span>
<span class="lineNum">     298 </span><span class="lineNoCov">          0 :     if (message_.get() == NULL)</span>
<span class="lineNum">     299 </span><span class="lineNoCov">          0 :       message_.reset(new ::std::string);</span>
<span class="lineNum">     300 </span><span class="lineNoCov">          0 :     message_-&gt;append(a_message.GetString().c_str());</span>
<span class="lineNum">     301 </span><span class="lineNoCov">          0 :   }</span>
<span class="lineNum">     302 </span>            : 
<span class="lineNum">     303 </span>            :   // Stores result of the assertion predicate.
<span class="lineNum">     304 </span>            :   bool success_;
<span class="lineNum">     305 </span>            :   // Stores the message describing the condition in case the expectation
<span class="lineNum">     306 </span>            :   // construct is not satisfied with the predicate's outcome.
<span class="lineNum">     307 </span>            :   // Referenced via a pointer to avoid taking too much stack frame space
<span class="lineNum">     308 </span>            :   // with test assertions.
<span class="lineNum">     309 </span>            :   internal::scoped_ptr&lt; ::std::string&gt; message_;
<span class="lineNum">     310 </span>            : 
<span class="lineNum">     311 </span>            :   GTEST_DISALLOW_ASSIGN_(AssertionResult);
<span class="lineNum">     312 </span>            : };
<span class="lineNum">     313 </span>            : 
<span class="lineNum">     314 </span>            : // Makes a successful assertion result.
<span class="lineNum">     315 </span>            : GTEST_API_ AssertionResult AssertionSuccess();
<span class="lineNum">     316 </span>            : 
<span class="lineNum">     317 </span>            : // Makes a failed assertion result.
<span class="lineNum">     318 </span>            : GTEST_API_ AssertionResult AssertionFailure();
<span class="lineNum">     319 </span>            : 
<span class="lineNum">     320 </span>            : // Makes a failed assertion result with the given failure message.
<span class="lineNum">     321 </span>            : // Deprecated; use AssertionFailure() &lt;&lt; msg.
<span class="lineNum">     322 </span>            : GTEST_API_ AssertionResult AssertionFailure(const Message&amp; msg);
<span class="lineNum">     323 </span>            : 
<span class="lineNum">     324 </span>            : // The abstract class that all tests inherit from.
<span class="lineNum">     325 </span>            : //
<span class="lineNum">     326 </span>            : // In Google Test, a unit test program contains one or many TestCases, and
<span class="lineNum">     327 </span>            : // each TestCase contains one or many Tests.
<span class="lineNum">     328 </span>            : //
<span class="lineNum">     329 </span>            : // When you define a test using the TEST macro, you don't need to
<span class="lineNum">     330 </span>            : // explicitly derive from Test - the TEST macro automatically does
<span class="lineNum">     331 </span>            : // this for you.
<span class="lineNum">     332 </span>            : //
<span class="lineNum">     333 </span>            : // The only time you derive from Test is when defining a test fixture
<span class="lineNum">     334 </span>            : // to be used a TEST_F.  For example:
<span class="lineNum">     335 </span>            : //
<span class="lineNum">     336 </span>            : //   class FooTest : public testing::Test {
<span class="lineNum">     337 </span>            : //    protected:
<span class="lineNum">     338 </span>            : //     virtual void SetUp() { ... }
<span class="lineNum">     339 </span>            : //     virtual void TearDown() { ... }
<span class="lineNum">     340 </span>            : //     ...
<span class="lineNum">     341 </span>            : //   };
<span class="lineNum">     342 </span>            : //
<span class="lineNum">     343 </span>            : //   TEST_F(FooTest, Bar) { ... }
<span class="lineNum">     344 </span>            : //   TEST_F(FooTest, Baz) { ... }
<span class="lineNum">     345 </span>            : //
<span class="lineNum">     346 </span>            : // Test is not copyable.
<span class="lineNum">     347 </span>            : class GTEST_API_ Test {
<span class="lineNum">     348 </span>            :  public:
<span class="lineNum">     349 </span>            :   friend class TestInfo;
<span class="lineNum">     350 </span>            : 
<span class="lineNum">     351 </span>            :   // Defines types for pointers to functions that set up and tear down
<span class="lineNum">     352 </span>            :   // a test case.
<span class="lineNum">     353 </span>            :   typedef internal::SetUpTestCaseFunc SetUpTestCaseFunc;
<span class="lineNum">     354 </span>            :   typedef internal::TearDownTestCaseFunc TearDownTestCaseFunc;
<span class="lineNum">     355 </span>            : 
<span class="lineNum">     356 </span>            :   // The d'tor is virtual as we intend to inherit from Test.
<span class="lineNum">     357 </span>            :   virtual ~Test();
<span class="lineNum">     358 </span>            : 
<span class="lineNum">     359 </span>            :   // Sets up the stuff shared by all tests in this test case.
<span class="lineNum">     360 </span>            :   //
<span class="lineNum">     361 </span>            :   // Google Test will call Foo::SetUpTestCase() before running the first
<span class="lineNum">     362 </span>            :   // test in test case Foo.  Hence a sub-class can define its own
<a name="363"><span class="lineNum">     363 </span>            :   // SetUpTestCase() method to shadow the one defined in the super</a>
<span class="lineNum">     364 </span>            :   // class.
<span class="lineNum">     365 </span><span class="lineNoCov">          0 :   static void SetUpTestCase() {}</span>
<span class="lineNum">     366 </span>            : 
<span class="lineNum">     367 </span>            :   // Tears down the stuff shared by all tests in this test case.
<span class="lineNum">     368 </span>            :   //
<span class="lineNum">     369 </span>            :   // Google Test will call Foo::TearDownTestCase() after running the last
<span class="lineNum">     370 </span>            :   // test in test case Foo.  Hence a sub-class can define its own
<a name="371"><span class="lineNum">     371 </span>            :   // TearDownTestCase() method to shadow the one defined in the super</a>
<span class="lineNum">     372 </span>            :   // class.
<span class="lineNum">     373 </span><span class="lineNoCov">          0 :   static void TearDownTestCase() {}</span>
<span class="lineNum">     374 </span>            : 
<span class="lineNum">     375 </span>            :   // Returns true iff the current test has a fatal failure.
<span class="lineNum">     376 </span>            :   static bool HasFatalFailure();
<span class="lineNum">     377 </span>            : 
<span class="lineNum">     378 </span>            :   // Returns true iff the current test has a non-fatal failure.
<span class="lineNum">     379 </span>            :   static bool HasNonfatalFailure();
<span class="lineNum">     380 </span>            : 
<span class="lineNum">     381 </span>            :   // Returns true iff the current test has a (either fatal or
<span class="lineNum">     382 </span>            :   // non-fatal) failure.
<span class="lineNum">     383 </span>            :   static bool HasFailure() { return HasFatalFailure() || HasNonfatalFailure(); }
<span class="lineNum">     384 </span>            : 
<span class="lineNum">     385 </span>            :   // Logs a property for the current test, test case, or for the entire
<span class="lineNum">     386 </span>            :   // invocation of the test program when used outside of the context of a
<span class="lineNum">     387 </span>            :   // test case.  Only the last value for a given key is remembered.  These
<span class="lineNum">     388 </span>            :   // are public static so they can be called from utility functions that are
<span class="lineNum">     389 </span>            :   // not members of the test fixture.  Calls to RecordProperty made during
<span class="lineNum">     390 </span>            :   // lifespan of the test (from the moment its constructor starts to the
<span class="lineNum">     391 </span>            :   // moment its destructor finishes) will be output in XML as attributes of
<span class="lineNum">     392 </span>            :   // the &lt;testcase&gt; element.  Properties recorded from fixture's
<span class="lineNum">     393 </span>            :   // SetUpTestCase or TearDownTestCase are logged as attributes of the
<span class="lineNum">     394 </span>            :   // corresponding &lt;testsuite&gt; element.  Calls to RecordProperty made in the
<span class="lineNum">     395 </span>            :   // global context (before or after invocation of RUN_ALL_TESTS and from
<span class="lineNum">     396 </span>            :   // SetUp/TearDown method of Environment objects registered with Google
<span class="lineNum">     397 </span>            :   // Test) will be output as attributes of the &lt;testsuites&gt; element.
<span class="lineNum">     398 </span>            :   static void RecordProperty(const std::string&amp; key, const std::string&amp; value);
<span class="lineNum">     399 </span>            :   static void RecordProperty(const std::string&amp; key, int value);
<span class="lineNum">     400 </span>            : 
<span class="lineNum">     401 </span>            :  protected:
<span class="lineNum">     402 </span>            :   // Creates a Test object.
<span class="lineNum">     403 </span>            :   Test();
<span class="lineNum">     404 </span>            : 
<span class="lineNum">     405 </span>            :   // Sets up the test fixture.
<span class="lineNum">     406 </span>            :   virtual void SetUp();
<span class="lineNum">     407 </span>            : 
<span class="lineNum">     408 </span>            :   // Tears down the test fixture.
<span class="lineNum">     409 </span>            :   virtual void TearDown();
<span class="lineNum">     410 </span>            : 
<span class="lineNum">     411 </span>            :  private:
<span class="lineNum">     412 </span>            :   // Returns true iff the current test has the same fixture class as
<span class="lineNum">     413 </span>            :   // the first test in the current test case.
<span class="lineNum">     414 </span>            :   static bool HasSameFixtureClass();
<span class="lineNum">     415 </span>            : 
<span class="lineNum">     416 </span>            :   // Runs the test after the test fixture has been set up.
<span class="lineNum">     417 </span>            :   //
<span class="lineNum">     418 </span>            :   // A sub-class must implement this to define the test logic.
<span class="lineNum">     419 </span>            :   //
<span class="lineNum">     420 </span>            :   // DO NOT OVERRIDE THIS FUNCTION DIRECTLY IN A USER PROGRAM.
<span class="lineNum">     421 </span>            :   // Instead, use the TEST or TEST_F macro.
<span class="lineNum">     422 </span>            :   virtual void TestBody() = 0;
<span class="lineNum">     423 </span>            : 
<span class="lineNum">     424 </span>            :   // Sets up, executes, and tears down the test.
<span class="lineNum">     425 </span>            :   void Run();
<span class="lineNum">     426 </span>            : 
<a name="427"><span class="lineNum">     427 </span>            :   // Deletes self.  We deliberately pick an unusual name for this</a>
<span class="lineNum">     428 </span>            :   // internal method to avoid clashing with names used in user TESTs.
<span class="lineNum">     429 </span><span class="lineNoCov">          0 :   void DeleteSelf_() { delete this; }</span>
<span class="lineNum">     430 </span>            : 
<span class="lineNum">     431 </span>            :   // Uses a GTestFlagSaver to save and restore all Google Test flags.
<span class="lineNum">     432 </span>            :   const internal::GTestFlagSaver* const gtest_flag_saver_;
<span class="lineNum">     433 </span>            : 
<span class="lineNum">     434 </span>            :   // Often a user mis-spells SetUp() as Setup() and spends a long time
<span class="lineNum">     435 </span>            :   // wondering why it is never called by Google Test.  The declaration of
<span class="lineNum">     436 </span>            :   // the following method is solely for catching such an error at
<span class="lineNum">     437 </span>            :   // compile time:
<span class="lineNum">     438 </span>            :   //
<span class="lineNum">     439 </span>            :   //   - The return type is deliberately chosen to be not void, so it
<span class="lineNum">     440 </span>            :   //   will be a conflict if a user declares void Setup() in his test
<span class="lineNum">     441 </span>            :   //   fixture.
<span class="lineNum">     442 </span>            :   //
<span class="lineNum">     443 </span>            :   //   - This method is private, so it will be another compiler error
<span class="lineNum">     444 </span>            :   //   if a user calls it from his test fixture.
<span class="lineNum">     445 </span>            :   //
<span class="lineNum">     446 </span>            :   // DO NOT OVERRIDE THIS FUNCTION.
<span class="lineNum">     447 </span>            :   //
<span class="lineNum">     448 </span>            :   // If you see an error about overriding the following function or
<a name="449"><span class="lineNum">     449 </span>            :   // about it being private, you have mis-spelled SetUp() as Setup().</a>
<span class="lineNum">     450 </span>            :   struct Setup_should_be_spelled_SetUp {};
<span class="lineNum">     451 </span><span class="lineNoCov">          0 :   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }</span>
<span class="lineNum">     452 </span>            : 
<span class="lineNum">     453 </span>            :   // We disallow copying Tests.
<span class="lineNum">     454 </span>            :   GTEST_DISALLOW_COPY_AND_ASSIGN_(Test);
<span class="lineNum">     455 </span>            : };
<span class="lineNum">     456 </span>            : 
<span class="lineNum">     457 </span>            : typedef internal::TimeInMillis TimeInMillis;
<span class="lineNum">     458 </span>            : 
<span class="lineNum">     459 </span>            : // A copyable object representing a user specified test property which can be
<span class="lineNum">     460 </span>            : // output as a key/value string pair.
<a name="461"><span class="lineNum">     461 </span>            : //</a>
<span class="lineNum">     462 </span>            : // Don't inherit from TestProperty as its destructor is not virtual.
<span class="lineNum">     463 </span><span class="lineNoCov">          0 : class TestProperty {</span>
<span class="lineNum">     464 </span>            :  public:
<span class="lineNum">     465 </span>            :   // C'tor.  TestProperty does NOT have a default constructor.
<a name="466"><span class="lineNum">     466 </span>            :   // Always use this constructor (with parameters) to create a</a>
<span class="lineNum">     467 </span>            :   // TestProperty object.
<span class="lineNum">     468 </span><span class="lineNoCov">          0 :   TestProperty(const std::string&amp; a_key, const std::string&amp; a_value) :</span>
<span class="lineNum">     469 </span><span class="lineNoCov">          0 :     key_(a_key), value_(a_value) {</span>
<span class="lineNum">     470 </span><span class="lineNoCov">          0 :   }</span>
<a name="471"><span class="lineNum">     471 </span>            : </a>
<span class="lineNum">     472 </span>            :   // Gets the user supplied key.
<span class="lineNum">     473 </span><span class="lineNoCov">          0 :   const char* key() const {</span>
<span class="lineNum">     474 </span><span class="lineNoCov">          0 :     return key_.c_str();</span>
<span class="lineNum">     475 </span>            :   }
<a name="476"><span class="lineNum">     476 </span>            : </a>
<span class="lineNum">     477 </span>            :   // Gets the user supplied value.
<span class="lineNum">     478 </span><span class="lineNoCov">          0 :   const char* value() const {</span>
<span class="lineNum">     479 </span><span class="lineNoCov">          0 :     return value_.c_str();</span>
<span class="lineNum">     480 </span>            :   }
<a name="481"><span class="lineNum">     481 </span>            : </a>
<span class="lineNum">     482 </span>            :   // Sets a new value, overriding the one supplied in the constructor.
<span class="lineNum">     483 </span><span class="lineNoCov">          0 :   void SetValue(const std::string&amp; new_value) {</span>
<span class="lineNum">     484 </span><span class="lineNoCov">          0 :     value_ = new_value;</span>
<span class="lineNum">     485 </span><span class="lineNoCov">          0 :   }</span>
<span class="lineNum">     486 </span>            : 
<span class="lineNum">     487 </span>            :  private:
<span class="lineNum">     488 </span>            :   // The key supplied by the user.
<span class="lineNum">     489 </span>            :   std::string key_;
<span class="lineNum">     490 </span>            :   // The value supplied by the user.
<span class="lineNum">     491 </span>            :   std::string value_;
<span class="lineNum">     492 </span>            : };
<span class="lineNum">     493 </span>            : 
<span class="lineNum">     494 </span>            : // The result of a single Test.  This includes a list of
<span class="lineNum">     495 </span>            : // TestPartResults, a list of TestProperties, a count of how many
<span class="lineNum">     496 </span>            : // death tests there are in the Test, and how much time it took to run
<span class="lineNum">     497 </span>            : // the Test.
<span class="lineNum">     498 </span>            : //
<span class="lineNum">     499 </span>            : // TestResult is not copyable.
<span class="lineNum">     500 </span>            : class GTEST_API_ TestResult {
<span class="lineNum">     501 </span>            :  public:
<span class="lineNum">     502 </span>            :   // Creates an empty TestResult.
<span class="lineNum">     503 </span>            :   TestResult();
<span class="lineNum">     504 </span>            : 
<span class="lineNum">     505 </span>            :   // D'tor.  Do not inherit from TestResult.
<span class="lineNum">     506 </span>            :   ~TestResult();
<span class="lineNum">     507 </span>            : 
<span class="lineNum">     508 </span>            :   // Gets the number of all test parts.  This is the sum of the number
<span class="lineNum">     509 </span>            :   // of successful test parts and the number of failed test parts.
<span class="lineNum">     510 </span>            :   int total_part_count() const;
<span class="lineNum">     511 </span>            : 
<span class="lineNum">     512 </span>            :   // Returns the number of the test properties.
<span class="lineNum">     513 </span>            :   int test_property_count() const;
<a name="514"><span class="lineNum">     514 </span>            : </a>
<span class="lineNum">     515 </span>            :   // Returns true iff the test passed (i.e. no test part failed).
<span class="lineNum">     516 </span><span class="lineNoCov">          0 :   bool Passed() const { return !Failed(); }</span>
<span class="lineNum">     517 </span>            : 
<span class="lineNum">     518 </span>            :   // Returns true iff the test failed.
<span class="lineNum">     519 </span>            :   bool Failed() const;
<span class="lineNum">     520 </span>            : 
<span class="lineNum">     521 </span>            :   // Returns true iff the test fatally failed.
<span class="lineNum">     522 </span>            :   bool HasFatalFailure() const;
<span class="lineNum">     523 </span>            : 
<span class="lineNum">     524 </span>            :   // Returns true iff the test has a non-fatal failure.
<span class="lineNum">     525 </span>            :   bool HasNonfatalFailure() const;
<a name="526"><span class="lineNum">     526 </span>            : </a>
<span class="lineNum">     527 </span>            :   // Returns the elapsed time, in milliseconds.
<span class="lineNum">     528 </span><span class="lineNoCov">          0 :   TimeInMillis elapsed_time() const { return elapsed_time_; }</span>
<span class="lineNum">     529 </span>            : 
<span class="lineNum">     530 </span>            :   // Returns the i-th test part result among all the results. i can range
<span class="lineNum">     531 </span>            :   // from 0 to test_property_count() - 1. If i is not in that range, aborts
<span class="lineNum">     532 </span>            :   // the program.
<span class="lineNum">     533 </span>            :   const TestPartResult&amp; GetTestPartResult(int i) const;
<span class="lineNum">     534 </span>            : 
<span class="lineNum">     535 </span>            :   // Returns the i-th test property. i can range from 0 to
<span class="lineNum">     536 </span>            :   // test_property_count() - 1. If i is not in that range, aborts the
<span class="lineNum">     537 </span>            :   // program.
<span class="lineNum">     538 </span>            :   const TestProperty&amp; GetTestProperty(int i) const;
<span class="lineNum">     539 </span>            : 
<span class="lineNum">     540 </span>            :  private:
<span class="lineNum">     541 </span>            :   friend class TestInfo;
<span class="lineNum">     542 </span>            :   friend class TestCase;
<span class="lineNum">     543 </span>            :   friend class UnitTest;
<span class="lineNum">     544 </span>            :   friend class internal::DefaultGlobalTestPartResultReporter;
<span class="lineNum">     545 </span>            :   friend class internal::ExecDeathTest;
<span class="lineNum">     546 </span>            :   friend class internal::TestResultAccessor;
<span class="lineNum">     547 </span>            :   friend class internal::UnitTestImpl;
<span class="lineNum">     548 </span>            :   friend class internal::WindowsDeathTest;
<span class="lineNum">     549 </span>            : 
<span class="lineNum">     550 </span>            :   // Gets the vector of TestPartResults.
<span class="lineNum">     551 </span>            :   const std::vector&lt;TestPartResult&gt;&amp; test_part_results() const {
<span class="lineNum">     552 </span>            :     return test_part_results_;
<span class="lineNum">     553 </span>            :   }
<span class="lineNum">     554 </span>            : 
<span class="lineNum">     555 </span>            :   // Gets the vector of TestProperties.
<span class="lineNum">     556 </span>            :   const std::vector&lt;TestProperty&gt;&amp; test_properties() const {
<span class="lineNum">     557 </span>            :     return test_properties_;
<span class="lineNum">     558 </span>            :   }
<a name="559"><span class="lineNum">     559 </span>            : </a>
<span class="lineNum">     560 </span>            :   // Sets the elapsed time.
<span class="lineNum">     561 </span><span class="lineNoCov">          0 :   void set_elapsed_time(TimeInMillis elapsed) { elapsed_time_ = elapsed; }</span>
<span class="lineNum">     562 </span>            : 
<span class="lineNum">     563 </span>            :   // Adds a test property to the list. The property is validated and may add
<span class="lineNum">     564 </span>            :   // a non-fatal failure if invalid (e.g., if it conflicts with reserved
<span class="lineNum">     565 </span>            :   // key names). If a property is already recorded for the same key, the
<span class="lineNum">     566 </span>            :   // value will be updated, rather than storing multiple values for the same
<span class="lineNum">     567 </span>            :   // key.  xml_element specifies the element for which the property is being
<span class="lineNum">     568 </span>            :   // recorded and is used for validation.
<span class="lineNum">     569 </span>            :   void RecordProperty(const std::string&amp; xml_element,
<span class="lineNum">     570 </span>            :                       const TestProperty&amp; test_property);
<span class="lineNum">     571 </span>            : 
<span class="lineNum">     572 </span>            :   // Adds a failure if the key is a reserved attribute of Google Test
<span class="lineNum">     573 </span>            :   // testcase tags.  Returns true if the property is valid.
<span class="lineNum">     574 </span>            :   // TODO(russr): Validate attribute names are legal and human readable.
<span class="lineNum">     575 </span>            :   static bool ValidateTestProperty(const std::string&amp; xml_element,
<span class="lineNum">     576 </span>            :                                    const TestProperty&amp; test_property);
<span class="lineNum">     577 </span>            : 
<span class="lineNum">     578 </span>            :   // Adds a test part result to the list.
<span class="lineNum">     579 </span>            :   void AddTestPartResult(const TestPartResult&amp; test_part_result);
<a name="580"><span class="lineNum">     580 </span>            : </a>
<span class="lineNum">     581 </span>            :   // Returns the death test count.
<span class="lineNum">     582 </span><span class="lineNoCov">          0 :   int death_test_count() const { return death_test_count_; }</span>
<a name="583"><span class="lineNum">     583 </span>            : </a>
<span class="lineNum">     584 </span>            :   // Increments the death test count, returning the new count.
<span class="lineNum">     585 </span><span class="lineNoCov">          0 :   int increment_death_test_count() { return ++death_test_count_; }</span>
<span class="lineNum">     586 </span>            : 
<span class="lineNum">     587 </span>            :   // Clears the test part results.
<span class="lineNum">     588 </span>            :   void ClearTestPartResults();
<span class="lineNum">     589 </span>            : 
<span class="lineNum">     590 </span>            :   // Clears the object.
<span class="lineNum">     591 </span>            :   void Clear();
<span class="lineNum">     592 </span>            : 
<span class="lineNum">     593 </span>            :   // Protects mutable state of the property vector and of owned
<span class="lineNum">     594 </span>            :   // properties, whose values may be updated.
<span class="lineNum">     595 </span>            :   internal::Mutex test_properites_mutex_;
<span class="lineNum">     596 </span>            : 
<span class="lineNum">     597 </span>            :   // The vector of TestPartResults
<span class="lineNum">     598 </span>            :   std::vector&lt;TestPartResult&gt; test_part_results_;
<span class="lineNum">     599 </span>            :   // The vector of TestProperties
<span class="lineNum">     600 </span>            :   std::vector&lt;TestProperty&gt; test_properties_;
<span class="lineNum">     601 </span>            :   // Running count of death tests.
<span class="lineNum">     602 </span>            :   int death_test_count_;
<span class="lineNum">     603 </span>            :   // The elapsed time, in milliseconds.
<span class="lineNum">     604 </span>            :   TimeInMillis elapsed_time_;
<span class="lineNum">     605 </span>            : 
<span class="lineNum">     606 </span>            :   // We disallow copying TestResult.
<span class="lineNum">     607 </span>            :   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestResult);
<span class="lineNum">     608 </span>            : };  // class TestResult
<span class="lineNum">     609 </span>            : 
<span class="lineNum">     610 </span>            : // A TestInfo object stores the following information about a test:
<span class="lineNum">     611 </span>            : //
<span class="lineNum">     612 </span>            : //   Test case name
<span class="lineNum">     613 </span>            : //   Test name
<span class="lineNum">     614 </span>            : //   Whether the test should be run
<span class="lineNum">     615 </span>            : //   A function pointer that creates the test object when invoked
<span class="lineNum">     616 </span>            : //   Test result
<span class="lineNum">     617 </span>            : //
<span class="lineNum">     618 </span>            : // The constructor of TestInfo registers itself with the UnitTest
<span class="lineNum">     619 </span>            : // singleton such that the RUN_ALL_TESTS() macro knows which tests to
<span class="lineNum">     620 </span>            : // run.
<span class="lineNum">     621 </span>            : class GTEST_API_ TestInfo {
<span class="lineNum">     622 </span>            :  public:
<span class="lineNum">     623 </span>            :   // Destructs a TestInfo object.  This function is not virtual, so
<span class="lineNum">     624 </span>            :   // don't inherit from TestInfo.
<span class="lineNum">     625 </span>            :   ~TestInfo();
<a name="626"><span class="lineNum">     626 </span>            : </a>
<span class="lineNum">     627 </span>            :   // Returns the test case name.
<span class="lineNum">     628 </span><span class="lineNoCov">          0 :   const char* test_case_name() const { return test_case_name_.c_str(); }</span>
<a name="629"><span class="lineNum">     629 </span>            : </a>
<span class="lineNum">     630 </span>            :   // Returns the test name.
<span class="lineNum">     631 </span><span class="lineNoCov">          0 :   const char* name() const { return name_.c_str(); }</span>
<span class="lineNum">     632 </span>            : 
<a name="633"><span class="lineNum">     633 </span>            :   // Returns the name of the parameter type, or NULL if this is not a typed</a>
<span class="lineNum">     634 </span>            :   // or a type-parameterized test.
<span class="lineNum">     635 </span><span class="lineNoCov">          0 :   const char* type_param() const {</span>
<span class="lineNum">     636 </span><span class="lineNoCov">          0 :     if (type_param_.get() != NULL)</span>
<span class="lineNum">     637 </span><span class="lineNoCov">          0 :       return type_param_-&gt;c_str();</span>
<span class="lineNum">     638 </span><span class="lineNoCov">          0 :     return NULL;</span>
<span class="lineNum">     639 </span>            :   }
<span class="lineNum">     640 </span>            : 
<a name="641"><span class="lineNum">     641 </span>            :   // Returns the text representation of the value parameter, or NULL if this</a>
<span class="lineNum">     642 </span>            :   // is not a value-parameterized test.
<span class="lineNum">     643 </span><span class="lineNoCov">          0 :   const char* value_param() const {</span>
<span class="lineNum">     644 </span><span class="lineNoCov">          0 :     if (value_param_.get() != NULL)</span>
<span class="lineNum">     645 </span><span class="lineNoCov">          0 :       return value_param_-&gt;c_str();</span>
<span class="lineNum">     646 </span><span class="lineNoCov">          0 :     return NULL;</span>
<span class="lineNum">     647 </span>            :   }
<span class="lineNum">     648 </span>            : 
<span class="lineNum">     649 </span>            :   // Returns true if this test should run, that is if the test is not
<span class="lineNum">     650 </span>            :   // disabled (or it is disabled but the also_run_disabled_tests flag has
<span class="lineNum">     651 </span>            :   // been specified) and its full name matches the user-specified filter.
<span class="lineNum">     652 </span>            :   //
<span class="lineNum">     653 </span>            :   // Google Test allows the user to filter the tests by their full names.
<span class="lineNum">     654 </span>            :   // The full name of a test Bar in test case Foo is defined as
<span class="lineNum">     655 </span>            :   // &quot;Foo.Bar&quot;.  Only the tests that match the filter will run.
<span class="lineNum">     656 </span>            :   //
<span class="lineNum">     657 </span>            :   // A filter is a colon-separated list of glob (not regex) patterns,
<span class="lineNum">     658 </span>            :   // optionally followed by a '-' and a colon-separated list of
<span class="lineNum">     659 </span>            :   // negative patterns (tests to exclude).  A test is run if it
<span class="lineNum">     660 </span>            :   // matches one of the positive patterns and does not match any of
<span class="lineNum">     661 </span>            :   // the negative patterns.
<span class="lineNum">     662 </span>            :   //
<a name="663"><span class="lineNum">     663 </span>            :   // For example, *A*:Foo.* is a filter that matches any string that</a>
<span class="lineNum">     664 </span>            :   // contains the character 'A' or starts with &quot;Foo.&quot;.
<span class="lineNum">     665 </span><span class="lineNoCov">          0 :   bool should_run() const { return should_run_; }</span>
<a name="666"><span class="lineNum">     666 </span>            : </a>
<span class="lineNum">     667 </span>            :   // Returns true iff this test will appear in the XML report.
<span class="lineNum">     668 </span><span class="lineNoCov">          0 :   bool is_reportable() const {</span>
<span class="lineNum">     669 </span>            :     // For now, the XML report includes all tests matching the filter.
<span class="lineNum">     670 </span>            :     // In the future, we may trim tests that are excluded because of
<span class="lineNum">     671 </span>            :     // sharding.
<span class="lineNum">     672 </span><span class="lineNoCov">          0 :     return matches_filter_;</span>
<span class="lineNum">     673 </span>            :   }
<a name="674"><span class="lineNum">     674 </span>            : </a>
<span class="lineNum">     675 </span>            :   // Returns the result of the test.
<span class="lineNum">     676 </span><span class="lineNoCov">          0 :   const TestResult* result() const { return &amp;result_; }</span>
<span class="lineNum">     677 </span>            : 
<span class="lineNum">     678 </span>            :  private:
<span class="lineNum">     679 </span>            : #if GTEST_HAS_DEATH_TEST
<span class="lineNum">     680 </span>            :   friend class internal::DefaultDeathTestFactory;
<span class="lineNum">     681 </span>            : #endif  // GTEST_HAS_DEATH_TEST
<span class="lineNum">     682 </span>            :   friend class Test;
<span class="lineNum">     683 </span>            :   friend class TestCase;
<span class="lineNum">     684 </span>            :   friend class internal::UnitTestImpl;
<span class="lineNum">     685 </span>            :   friend class internal::StreamingListenerTest;
<span class="lineNum">     686 </span>            :   friend TestInfo* internal::MakeAndRegisterTestInfo(
<span class="lineNum">     687 </span>            :       const char* test_case_name,
<span class="lineNum">     688 </span>            :       const char* name,
<span class="lineNum">     689 </span>            :       const char* type_param,
<span class="lineNum">     690 </span>            :       const char* value_param,
<span class="lineNum">     691 </span>            :       internal::TypeId fixture_class_id,
<span class="lineNum">     692 </span>            :       Test::SetUpTestCaseFunc set_up_tc,
<span class="lineNum">     693 </span>            :       Test::TearDownTestCaseFunc tear_down_tc,
<span class="lineNum">     694 </span>            :       internal::TestFactoryBase* factory);
<span class="lineNum">     695 </span>            : 
<span class="lineNum">     696 </span>            :   // Constructs a TestInfo object. The newly constructed instance assumes
<span class="lineNum">     697 </span>            :   // ownership of the factory object.
<span class="lineNum">     698 </span>            :   TestInfo(const std::string&amp; test_case_name,
<span class="lineNum">     699 </span>            :            const std::string&amp; name,
<span class="lineNum">     700 </span>            :            const char* a_type_param,   // NULL if not a type-parameterized test
<span class="lineNum">     701 </span>            :            const char* a_value_param,  // NULL if not a value-parameterized test
<span class="lineNum">     702 </span>            :            internal::TypeId fixture_class_id,
<span class="lineNum">     703 </span>            :            internal::TestFactoryBase* factory);
<span class="lineNum">     704 </span>            : 
<a name="705"><span class="lineNum">     705 </span>            :   // Increments the number of death tests encountered in this test so</a>
<span class="lineNum">     706 </span>            :   // far.
<span class="lineNum">     707 </span><span class="lineNoCov">          0 :   int increment_death_test_count() {</span>
<span class="lineNum">     708 </span><span class="lineNoCov">          0 :     return result_.increment_death_test_count();</span>
<span class="lineNum">     709 </span>            :   }
<span class="lineNum">     710 </span>            : 
<span class="lineNum">     711 </span>            :   // Creates the test object, runs it, records its result, and then
<span class="lineNum">     712 </span>            :   // deletes it.
<a name="713"><span class="lineNum">     713 </span>            :   void Run();</a>
<span class="lineNum">     714 </span>            : 
<span class="lineNum">     715 </span><span class="lineNoCov">          0 :   static void ClearTestResult(TestInfo* test_info) {</span>
<span class="lineNum">     716 </span><span class="lineNoCov">          0 :     test_info-&gt;result_.Clear();</span>
<span class="lineNum">     717 </span><span class="lineNoCov">          0 :   }</span>
<span class="lineNum">     718 </span>            : 
<span class="lineNum">     719 </span>            :   // These fields are immutable properties of the test.
<span class="lineNum">     720 </span>            :   const std::string test_case_name_;     // Test case name
<span class="lineNum">     721 </span>            :   const std::string name_;               // Test name
<span class="lineNum">     722 </span>            :   // Name of the parameter type, or NULL if this is not a typed or a
<span class="lineNum">     723 </span>            :   // type-parameterized test.
<span class="lineNum">     724 </span>            :   const internal::scoped_ptr&lt;const ::std::string&gt; type_param_;
<span class="lineNum">     725 </span>            :   // Text representation of the value parameter, or NULL if this is not a
<span class="lineNum">     726 </span>            :   // value-parameterized test.
<span class="lineNum">     727 </span>            :   const internal::scoped_ptr&lt;const ::std::string&gt; value_param_;
<span class="lineNum">     728 </span>            :   const internal::TypeId fixture_class_id_;   // ID of the test fixture class
<span class="lineNum">     729 </span>            :   bool should_run_;                 // True iff this test should run
<span class="lineNum">     730 </span>            :   bool is_disabled_;                // True iff this test is disabled
<span class="lineNum">     731 </span>            :   bool matches_filter_;             // True if this test matches the
<span class="lineNum">     732 </span>            :                                     // user-specified filter.
<span class="lineNum">     733 </span>            :   internal::TestFactoryBase* const factory_;  // The factory that creates
<span class="lineNum">     734 </span>            :                                               // the test object
<span class="lineNum">     735 </span>            : 
<span class="lineNum">     736 </span>            :   // This field is mutable and needs to be reset before running the
<span class="lineNum">     737 </span>            :   // test for the second time.
<span class="lineNum">     738 </span>            :   TestResult result_;
<span class="lineNum">     739 </span>            : 
<span class="lineNum">     740 </span>            :   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestInfo);
<span class="lineNum">     741 </span>            : };
<span class="lineNum">     742 </span>            : 
<span class="lineNum">     743 </span>            : // A test case, which consists of a vector of TestInfos.
<span class="lineNum">     744 </span>            : //
<span class="lineNum">     745 </span>            : // TestCase is not copyable.
<span class="lineNum">     746 </span>            : class GTEST_API_ TestCase {
<span class="lineNum">     747 </span>            :  public:
<span class="lineNum">     748 </span>            :   // Creates a TestCase with the given name.
<span class="lineNum">     749 </span>            :   //
<span class="lineNum">     750 </span>            :   // TestCase does NOT have a default constructor.  Always use this
<span class="lineNum">     751 </span>            :   // constructor to create a TestCase object.
<span class="lineNum">     752 </span>            :   //
<span class="lineNum">     753 </span>            :   // Arguments:
<span class="lineNum">     754 </span>            :   //
<span class="lineNum">     755 </span>            :   //   name:         name of the test case
<span class="lineNum">     756 </span>            :   //   a_type_param: the name of the test's type parameter, or NULL if
<span class="lineNum">     757 </span>            :   //                 this is not a type-parameterized test.
<span class="lineNum">     758 </span>            :   //   set_up_tc:    pointer to the function that sets up the test case
<span class="lineNum">     759 </span>            :   //   tear_down_tc: pointer to the function that tears down the test case
<span class="lineNum">     760 </span>            :   TestCase(const char* name, const char* a_type_param,
<span class="lineNum">     761 </span>            :            Test::SetUpTestCaseFunc set_up_tc,
<span class="lineNum">     762 </span>            :            Test::TearDownTestCaseFunc tear_down_tc);
<span class="lineNum">     763 </span>            : 
<span class="lineNum">     764 </span>            :   // Destructor of TestCase.
<span class="lineNum">     765 </span>            :   virtual ~TestCase();
<a name="766"><span class="lineNum">     766 </span>            : </a>
<span class="lineNum">     767 </span>            :   // Gets the name of the TestCase.
<span class="lineNum">     768 </span><span class="lineNoCov">          0 :   const char* name() const { return name_.c_str(); }</span>
<span class="lineNum">     769 </span>            : 
<a name="770"><span class="lineNum">     770 </span>            :   // Returns the name of the parameter type, or NULL if this is not a</a>
<span class="lineNum">     771 </span>            :   // type-parameterized test case.
<span class="lineNum">     772 </span><span class="lineNoCov">          0 :   const char* type_param() const {</span>
<span class="lineNum">     773 </span><span class="lineNoCov">          0 :     if (type_param_.get() != NULL)</span>
<span class="lineNum">     774 </span><span class="lineNoCov">          0 :       return type_param_-&gt;c_str();</span>
<span class="lineNum">     775 </span><span class="lineNoCov">          0 :     return NULL;</span>
<span class="lineNum">     776 </span>            :   }
<a name="777"><span class="lineNum">     777 </span>            : </a>
<span class="lineNum">     778 </span>            :   // Returns true if any test in this test case should run.
<span class="lineNum">     779 </span><span class="lineNoCov">          0 :   bool should_run() const { return should_run_; }</span>
<span class="lineNum">     780 </span>            : 
<span class="lineNum">     781 </span>            :   // Gets the number of successful tests in this test case.
<span class="lineNum">     782 </span>            :   int successful_test_count() const;
<span class="lineNum">     783 </span>            : 
<span class="lineNum">     784 </span>            :   // Gets the number of failed tests in this test case.
<span class="lineNum">     785 </span>            :   int failed_test_count() const;
<span class="lineNum">     786 </span>            : 
<span class="lineNum">     787 </span>            :   // Gets the number of disabled tests that will be reported in the XML report.
<span class="lineNum">     788 </span>            :   int reportable_disabled_test_count() const;
<span class="lineNum">     789 </span>            : 
<span class="lineNum">     790 </span>            :   // Gets the number of disabled tests in this test case.
<span class="lineNum">     791 </span>            :   int disabled_test_count() const;
<span class="lineNum">     792 </span>            : 
<span class="lineNum">     793 </span>            :   // Gets the number of tests to be printed in the XML report.
<span class="lineNum">     794 </span>            :   int reportable_test_count() const;
<span class="lineNum">     795 </span>            : 
<span class="lineNum">     796 </span>            :   // Get the number of tests in this test case that should run.
<span class="lineNum">     797 </span>            :   int test_to_run_count() const;
<span class="lineNum">     798 </span>            : 
<span class="lineNum">     799 </span>            :   // Gets the number of all tests in this test case.
<span class="lineNum">     800 </span>            :   int total_test_count() const;
<a name="801"><span class="lineNum">     801 </span>            : </a>
<span class="lineNum">     802 </span>            :   // Returns true iff the test case passed.
<span class="lineNum">     803 </span><span class="lineNoCov">          0 :   bool Passed() const { return !Failed(); }</span>
<a name="804"><span class="lineNum">     804 </span>            : </a>
<span class="lineNum">     805 </span>            :   // Returns true iff the test case failed.
<span class="lineNum">     806 </span><span class="lineNoCov">          0 :   bool Failed() const { return failed_test_count() &gt; 0; }</span>
<a name="807"><span class="lineNum">     807 </span>            : </a>
<span class="lineNum">     808 </span>            :   // Returns the elapsed time, in milliseconds.
<span class="lineNum">     809 </span><span class="lineNoCov">          0 :   TimeInMillis elapsed_time() const { return elapsed_time_; }</span>
<span class="lineNum">     810 </span>            : 
<span class="lineNum">     811 </span>            :   // Returns the i-th test among all the tests. i can range from 0 to
<span class="lineNum">     812 </span>            :   // total_test_count() - 1. If i is not in that range, returns NULL.
<span class="lineNum">     813 </span>            :   const TestInfo* GetTestInfo(int i) const;
<span class="lineNum">     814 </span>            : 
<a name="815"><span class="lineNum">     815 </span>            :   // Returns the TestResult that holds test properties recorded during</a>
<span class="lineNum">     816 </span>            :   // execution of SetUpTestCase and TearDownTestCase.
<span class="lineNum">     817 </span><span class="lineNoCov">          0 :   const TestResult&amp; ad_hoc_test_result() const { return ad_hoc_test_result_; }</span>
<span class="lineNum">     818 </span>            : 
<span class="lineNum">     819 </span>            :  private:
<span class="lineNum">     820 </span>            :   friend class Test;
<span class="lineNum">     821 </span>            :   friend class internal::UnitTestImpl;
<a name="822"><span class="lineNum">     822 </span>            : </a>
<span class="lineNum">     823 </span>            :   // Gets the (mutable) vector of TestInfos in this TestCase.
<span class="lineNum">     824 </span><span class="lineNoCov">          0 :   std::vector&lt;TestInfo*&gt;&amp; test_info_list() { return test_info_list_; }</span>
<a name="825"><span class="lineNum">     825 </span>            : </a>
<span class="lineNum">     826 </span>            :   // Gets the (immutable) vector of TestInfos in this TestCase.
<span class="lineNum">     827 </span><span class="lineNoCov">          0 :   const std::vector&lt;TestInfo*&gt;&amp; test_info_list() const {</span>
<span class="lineNum">     828 </span><span class="lineNoCov">          0 :     return test_info_list_;</span>
<span class="lineNum">     829 </span>            :   }
<span class="lineNum">     830 </span>            : 
<span class="lineNum">     831 </span>            :   // Returns the i-th test among all the tests. i can range from 0 to
<span class="lineNum">     832 </span>            :   // total_test_count() - 1. If i is not in that range, returns NULL.
<span class="lineNum">     833 </span>            :   TestInfo* GetMutableTestInfo(int i);
<a name="834"><span class="lineNum">     834 </span>            : </a>
<span class="lineNum">     835 </span>            :   // Sets the should_run member.
<span class="lineNum">     836 </span><span class="lineNoCov">          0 :   void set_should_run(bool should) { should_run_ = should; }</span>
<span class="lineNum">     837 </span>            : 
<span class="lineNum">     838 </span>            :   // Adds a TestInfo to this test case.  Will delete the TestInfo upon
<span class="lineNum">     839 </span>            :   // destruction of the TestCase object.
<span class="lineNum">     840 </span>            :   void AddTestInfo(TestInfo * test_info);
<span class="lineNum">     841 </span>            : 
<span class="lineNum">     842 </span>            :   // Clears the results of all tests in this test case.
<span class="lineNum">     843 </span>            :   void ClearResult();
<a name="844"><span class="lineNum">     844 </span>            : </a>
<span class="lineNum">     845 </span>            :   // Clears the results of all tests in the given test case.
<span class="lineNum">     846 </span><span class="lineNoCov">          0 :   static void ClearTestCaseResult(TestCase* test_case) {</span>
<span class="lineNum">     847 </span><span class="lineNoCov">          0 :     test_case-&gt;ClearResult();</span>
<span class="lineNum">     848 </span><span class="lineNoCov">          0 :   }</span>
<span class="lineNum">     849 </span>            : 
<span class="lineNum">     850 </span>            :   // Runs every test in this TestCase.
<span class="lineNum">     851 </span>            :   void Run();
<span class="lineNum">     852 </span>            : 
<a name="853"><span class="lineNum">     853 </span>            :   // Runs SetUpTestCase() for this TestCase.  This wrapper is needed</a>
<span class="lineNum">     854 </span>            :   // for catching exceptions thrown from SetUpTestCase().
<span class="lineNum">     855 </span><span class="lineNoCov">          0 :   void RunSetUpTestCase() { (*set_up_tc_)(); }</span>
<span class="lineNum">     856 </span>            : 
<a name="857"><span class="lineNum">     857 </span>            :   // Runs TearDownTestCase() for this TestCase.  This wrapper is</a>
<span class="lineNum">     858 </span>            :   // needed for catching exceptions thrown from TearDownTestCase().
<span class="lineNum">     859 </span><span class="lineNoCov">          0 :   void RunTearDownTestCase() { (*tear_down_tc_)(); }</span>
<a name="860"><span class="lineNum">     860 </span>            : </a>
<span class="lineNum">     861 </span>            :   // Returns true iff test passed.
<span class="lineNum">     862 </span><span class="lineNoCov">          0 :   static bool TestPassed(const TestInfo* test_info) {</span>
<span class="lineNum">     863 </span><span class="lineNoCov">          0 :     return test_info-&gt;should_run() &amp;&amp; test_info-&gt;result()-&gt;Passed();</span>
<span class="lineNum">     864 </span>            :   }
<a name="865"><span class="lineNum">     865 </span>            : </a>
<span class="lineNum">     866 </span>            :   // Returns true iff test failed.
<span class="lineNum">     867 </span><span class="lineNoCov">          0 :   static bool TestFailed(const TestInfo* test_info) {</span>
<span class="lineNum">     868 </span><span class="lineNoCov">          0 :     return test_info-&gt;should_run() &amp;&amp; test_info-&gt;result()-&gt;Failed();</span>
<span class="lineNum">     869 </span>            :   }
<span class="lineNum">     870 </span>            : 
<a name="871"><span class="lineNum">     871 </span>            :   // Returns true iff the test is disabled and will be reported in the XML</a>
<span class="lineNum">     872 </span>            :   // report.
<span class="lineNum">     873 </span><span class="lineNoCov">          0 :   static bool TestReportableDisabled(const TestInfo* test_info) {</span>
<span class="lineNum">     874 </span><span class="lineNoCov">          0 :     return test_info-&gt;is_reportable() &amp;&amp; test_info-&gt;is_disabled_;</span>
<span class="lineNum">     875 </span>            :   }
<a name="876"><span class="lineNum">     876 </span>            : </a>
<span class="lineNum">     877 </span>            :   // Returns true iff test is disabled.
<span class="lineNum">     878 </span><span class="lineNoCov">          0 :   static bool TestDisabled(const TestInfo* test_info) {</span>
<span class="lineNum">     879 </span><span class="lineNoCov">          0 :     return test_info-&gt;is_disabled_;</span>
<span class="lineNum">     880 </span>            :   }
<a name="881"><span class="lineNum">     881 </span>            : </a>
<span class="lineNum">     882 </span>            :   // Returns true iff this test will appear in the XML report.
<span class="lineNum">     883 </span><span class="lineNoCov">          0 :   static bool TestReportable(const TestInfo* test_info) {</span>
<span class="lineNum">     884 </span><span class="lineNoCov">          0 :     return test_info-&gt;is_reportable();</span>
<span class="lineNum">     885 </span>            :   }
<a name="886"><span class="lineNum">     886 </span>            : </a>
<span class="lineNum">     887 </span>            :   // Returns true if the given test should run.
<span class="lineNum">     888 </span><span class="lineNoCov">          0 :   static bool ShouldRunTest(const TestInfo* test_info) {</span>
<span class="lineNum">     889 </span><span class="lineNoCov">          0 :     return test_info-&gt;should_run();</span>
<span class="lineNum">     890 </span>            :   }
<span class="lineNum">     891 </span>            : 
<span class="lineNum">     892 </span>            :   // Shuffles the tests in this test case.
<span class="lineNum">     893 </span>            :   void ShuffleTests(internal::Random* random);
<span class="lineNum">     894 </span>            : 
<span class="lineNum">     895 </span>            :   // Restores the test order to before the first shuffle.
<span class="lineNum">     896 </span>            :   void UnshuffleTests();
<span class="lineNum">     897 </span>            : 
<span class="lineNum">     898 </span>            :   // Name of the test case.
<span class="lineNum">     899 </span>            :   std::string name_;
<span class="lineNum">     900 </span>            :   // Name of the parameter type, or NULL if this is not a typed or a
<span class="lineNum">     901 </span>            :   // type-parameterized test.
<span class="lineNum">     902 </span>            :   const internal::scoped_ptr&lt;const ::std::string&gt; type_param_;
<span class="lineNum">     903 </span>            :   // The vector of TestInfos in their original order.  It owns the
<span class="lineNum">     904 </span>            :   // elements in the vector.
<span class="lineNum">     905 </span>            :   std::vector&lt;TestInfo*&gt; test_info_list_;
<span class="lineNum">     906 </span>            :   // Provides a level of indirection for the test list to allow easy
<span class="lineNum">     907 </span>            :   // shuffling and restoring the test order.  The i-th element in this
<span class="lineNum">     908 </span>            :   // vector is the index of the i-th test in the shuffled test list.
<span class="lineNum">     909 </span>            :   std::vector&lt;int&gt; test_indices_;
<span class="lineNum">     910 </span>            :   // Pointer to the function that sets up the test case.
<span class="lineNum">     911 </span>            :   Test::SetUpTestCaseFunc set_up_tc_;
<span class="lineNum">     912 </span>            :   // Pointer to the function that tears down the test case.
<span class="lineNum">     913 </span>            :   Test::TearDownTestCaseFunc tear_down_tc_;
<span class="lineNum">     914 </span>            :   // True iff any test in this test case should run.
<span class="lineNum">     915 </span>            :   bool should_run_;
<span class="lineNum">     916 </span>            :   // Elapsed time, in milliseconds.
<span class="lineNum">     917 </span>            :   TimeInMillis elapsed_time_;
<span class="lineNum">     918 </span>            :   // Holds test properties recorded during execution of SetUpTestCase and
<span class="lineNum">     919 </span>            :   // TearDownTestCase.
<span class="lineNum">     920 </span>            :   TestResult ad_hoc_test_result_;
<span class="lineNum">     921 </span>            : 
<span class="lineNum">     922 </span>            :   // We disallow copying TestCases.
<span class="lineNum">     923 </span>            :   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestCase);
<span class="lineNum">     924 </span>            : };
<span class="lineNum">     925 </span>            : 
<span class="lineNum">     926 </span>            : // An Environment object is capable of setting up and tearing down an
<span class="lineNum">     927 </span>            : // environment.  The user should subclass this to define his own
<span class="lineNum">     928 </span>            : // environment(s).
<span class="lineNum">     929 </span>            : //
<span class="lineNum">     930 </span>            : // An Environment object does the set-up and tear-down in virtual
<span class="lineNum">     931 </span>            : // methods SetUp() and TearDown() instead of the constructor and the
<span class="lineNum">     932 </span>            : // destructor, as:
<span class="lineNum">     933 </span>            : //
<span class="lineNum">     934 </span>            : //   1. You cannot safely throw from a destructor.  This is a problem
<span class="lineNum">     935 </span>            : //      as in some cases Google Test is used where exceptions are enabled, and
<span class="lineNum">     936 </span>            : //      we may want to implement ASSERT_* using exceptions where they are
<span class="lineNum">     937 </span>            : //      available.
<span class="lineNum">     938 </span>            : //   2. You cannot use ASSERT_* directly in a constructor or
<span class="lineNum">     939 </span>            : //      destructor.
<span class="lineNum">     940 </span>            : class Environment {
<span class="lineNum">     941 </span>            :  public:
<span class="lineNum">     942 </span>            :   // The d'tor is virtual as we need to subclass Environment.
<span class="lineNum">     943 </span>            :   virtual ~Environment() {}
<span class="lineNum">     944 </span>            : 
<span class="lineNum">     945 </span>            :   // Override this to define how to set up the environment.
<span class="lineNum">     946 </span>            :   virtual void SetUp() {}
<span class="lineNum">     947 </span>            : 
<span class="lineNum">     948 </span>            :   // Override this to define how to tear down the environment.
<span class="lineNum">     949 </span>            :   virtual void TearDown() {}
<span class="lineNum">     950 </span>            :  private:
<span class="lineNum">     951 </span>            :   // If you see an error about overriding the following function or
<span class="lineNum">     952 </span>            :   // about it being private, you have mis-spelled SetUp() as Setup().
<span class="lineNum">     953 </span>            :   struct Setup_should_be_spelled_SetUp {};
<span class="lineNum">     954 </span>            :   virtual Setup_should_be_spelled_SetUp* Setup() { return NULL; }
<span class="lineNum">     955 </span>            : };
<span class="lineNum">     956 </span>            : 
<a name="957"><span class="lineNum">     957 </span>            : // The interface for tracing execution of tests. The methods are organized in</a>
<span class="lineNum">     958 </span>            : // the order the corresponding events are fired.
<a name="959"><span class="lineNum">     959 </span><span class="lineNoCov">          0 : class TestEventListener {</span></a>
<span class="lineNum">     960 </span>            :  public:
<span class="lineNum">     961 </span><span class="lineNoCov">          0 :   virtual ~TestEventListener() {}</span>
<span class="lineNum">     962 </span>            : 
<span class="lineNum">     963 </span>            :   // Fired before any test activity starts.
<span class="lineNum">     964 </span>            :   virtual void OnTestProgramStart(const UnitTest&amp; unit_test) = 0;
<span class="lineNum">     965 </span>            : 
<span class="lineNum">     966 </span>            :   // Fired before each iteration of tests starts.  There may be more than
<span class="lineNum">     967 </span>            :   // one iteration if GTEST_FLAG(repeat) is set. iteration is the iteration
<span class="lineNum">     968 </span>            :   // index, starting from 0.
<span class="lineNum">     969 </span>            :   virtual void OnTestIterationStart(const UnitTest&amp; unit_test,
<span class="lineNum">     970 </span>            :                                     int iteration) = 0;
<span class="lineNum">     971 </span>            : 
<span class="lineNum">     972 </span>            :   // Fired before environment set-up for each iteration of tests starts.
<span class="lineNum">     973 </span>            :   virtual void OnEnvironmentsSetUpStart(const UnitTest&amp; unit_test) = 0;
<span class="lineNum">     974 </span>            : 
<span class="lineNum">     975 </span>            :   // Fired after environment set-up for each iteration of tests ends.
<span class="lineNum">     976 </span>            :   virtual void OnEnvironmentsSetUpEnd(const UnitTest&amp; unit_test) = 0;
<span class="lineNum">     977 </span>            : 
<span class="lineNum">     978 </span>            :   // Fired before the test case starts.
<span class="lineNum">     979 </span>            :   virtual void OnTestCaseStart(const TestCase&amp; test_case) = 0;
<span class="lineNum">     980 </span>            : 
<span class="lineNum">     981 </span>            :   // Fired before the test starts.
<span class="lineNum">     982 </span>            :   virtual void OnTestStart(const TestInfo&amp; test_info) = 0;
<span class="lineNum">     983 </span>            : 
<span class="lineNum">     984 </span>            :   // Fired after a failed assertion or a SUCCEED() invocation.
<span class="lineNum">     985 </span>            :   virtual void OnTestPartResult(const TestPartResult&amp; test_part_result) = 0;
<span class="lineNum">     986 </span>            : 
<span class="lineNum">     987 </span>            :   // Fired after the test ends.
<span class="lineNum">     988 </span>            :   virtual void OnTestEnd(const TestInfo&amp; test_info) = 0;
<span class="lineNum">     989 </span>            : 
<span class="lineNum">     990 </span>            :   // Fired after the test case ends.
<span class="lineNum">     991 </span>            :   virtual void OnTestCaseEnd(const TestCase&amp; test_case) = 0;
<span class="lineNum">     992 </span>            : 
<span class="lineNum">     993 </span>            :   // Fired before environment tear-down for each iteration of tests starts.
<span class="lineNum">     994 </span>            :   virtual void OnEnvironmentsTearDownStart(const UnitTest&amp; unit_test) = 0;
<span class="lineNum">     995 </span>            : 
<span class="lineNum">     996 </span>            :   // Fired after environment tear-down for each iteration of tests ends.
<span class="lineNum">     997 </span>            :   virtual void OnEnvironmentsTearDownEnd(const UnitTest&amp; unit_test) = 0;
<span class="lineNum">     998 </span>            : 
<span class="lineNum">     999 </span>            :   // Fired after each iteration of tests finishes.
<span class="lineNum">    1000 </span>            :   virtual void OnTestIterationEnd(const UnitTest&amp; unit_test,
<span class="lineNum">    1001 </span>            :                                   int iteration) = 0;
<span class="lineNum">    1002 </span>            : 
<span class="lineNum">    1003 </span>            :   // Fired after all test activities have ended.
<span class="lineNum">    1004 </span>            :   virtual void OnTestProgramEnd(const UnitTest&amp; unit_test) = 0;
<span class="lineNum">    1005 </span>            : };
<span class="lineNum">    1006 </span>            : 
<span class="lineNum">    1007 </span>            : // The convenience class for users who need to override just one or two
<span class="lineNum">    1008 </span>            : // methods and are not concerned that a possible change to a signature of
<span class="lineNum">    1009 </span>            : // the methods they override will not be caught during the build.  For
<a name="1010"><span class="lineNum">    1010 </span>            : // comments about each method please see the definition of TestEventListener</a>
<span class="lineNum">    1011 </span>            : // above.
<a name="1012"><span class="lineNum">    1012 </span><span class="lineNoCov">          0 : class EmptyTestEventListener : public TestEventListener {</span></a>
<a name="1013"><span class="lineNum">    1013 </span>            :  public:</a>
<span class="lineNum">    1014 </span><span class="lineNoCov">          0 :   virtual void OnTestProgramStart(const UnitTest&amp; /*unit_test*/) {}</span>
<a name="1015"><span class="lineNum">    1015 </span><span class="lineNoCov">          0 :   virtual void OnTestIterationStart(const UnitTest&amp; /*unit_test*/,</span></a>
<a name="1016"><span class="lineNum">    1016 </span><span class="lineNoCov">          0 :                                     int /*iteration*/) {}</span></a>
<a name="1017"><span class="lineNum">    1017 </span><span class="lineNoCov">          0 :   virtual void OnEnvironmentsSetUpStart(const UnitTest&amp; /*unit_test*/) {}</span></a>
<a name="1018"><span class="lineNum">    1018 </span><span class="lineNoCov">          0 :   virtual void OnEnvironmentsSetUpEnd(const UnitTest&amp; /*unit_test*/) {}</span></a>
<a name="1019"><span class="lineNum">    1019 </span><span class="lineNoCov">          0 :   virtual void OnTestCaseStart(const TestCase&amp; /*test_case*/) {}</span></a>
<a name="1020"><span class="lineNum">    1020 </span><span class="lineNoCov">          0 :   virtual void OnTestStart(const TestInfo&amp; /*test_info*/) {}</span></a>
<a name="1021"><span class="lineNum">    1021 </span><span class="lineNoCov">          0 :   virtual void OnTestPartResult(const TestPartResult&amp; /*test_part_result*/) {}</span></a>
<a name="1022"><span class="lineNum">    1022 </span><span class="lineNoCov">          0 :   virtual void OnTestEnd(const TestInfo&amp; /*test_info*/) {}</span></a>
<a name="1023"><span class="lineNum">    1023 </span><span class="lineNoCov">          0 :   virtual void OnTestCaseEnd(const TestCase&amp; /*test_case*/) {}</span></a>
<a name="1024"><span class="lineNum">    1024 </span><span class="lineNoCov">          0 :   virtual void OnEnvironmentsTearDownStart(const UnitTest&amp; /*unit_test*/) {}</span></a>
<span class="lineNum">    1025 </span><span class="lineNoCov">          0 :   virtual void OnEnvironmentsTearDownEnd(const UnitTest&amp; /*unit_test*/) {}</span>
<a name="1026"><span class="lineNum">    1026 </span><span class="lineNoCov">          0 :   virtual void OnTestIterationEnd(const UnitTest&amp; /*unit_test*/,</span></a>
<span class="lineNum">    1027 </span><span class="lineNoCov">          0 :                                   int /*iteration*/) {}</span>
<span class="lineNum">    1028 </span><span class="lineNoCov">          0 :   virtual void OnTestProgramEnd(const UnitTest&amp; /*unit_test*/) {}</span>
<span class="lineNum">    1029 </span>            : };
<span class="lineNum">    1030 </span>            : 
<span class="lineNum">    1031 </span>            : // TestEventListeners lets users add listeners to track events in Google Test.
<span class="lineNum">    1032 </span>            : class GTEST_API_ TestEventListeners {
<span class="lineNum">    1033 </span>            :  public:
<span class="lineNum">    1034 </span>            :   TestEventListeners();
<span class="lineNum">    1035 </span>            :   ~TestEventListeners();
<span class="lineNum">    1036 </span>            : 
<span class="lineNum">    1037 </span>            :   // Appends an event listener to the end of the list. Google Test assumes
<span class="lineNum">    1038 </span>            :   // the ownership of the listener (i.e. it will delete the listener when
<span class="lineNum">    1039 </span>            :   // the test program finishes).
<span class="lineNum">    1040 </span>            :   void Append(TestEventListener* listener);
<span class="lineNum">    1041 </span>            : 
<span class="lineNum">    1042 </span>            :   // Removes the given event listener from the list and returns it.  It then
<span class="lineNum">    1043 </span>            :   // becomes the caller's responsibility to delete the listener. Returns
<span class="lineNum">    1044 </span>            :   // NULL if the listener is not found in the list.
<span class="lineNum">    1045 </span>            :   TestEventListener* Release(TestEventListener* listener);
<span class="lineNum">    1046 </span>            : 
<span class="lineNum">    1047 </span>            :   // Returns the standard listener responsible for the default console
<span class="lineNum">    1048 </span>            :   // output.  Can be removed from the listeners list to shut down default
<span class="lineNum">    1049 </span>            :   // console output.  Note that removing this object from the listener list
<span class="lineNum">    1050 </span>            :   // with Release transfers its ownership to the caller and makes this
<span class="lineNum">    1051 </span>            :   // function return NULL the next time.
<span class="lineNum">    1052 </span>            :   TestEventListener* default_result_printer() const {
<span class="lineNum">    1053 </span>            :     return default_result_printer_;
<span class="lineNum">    1054 </span>            :   }
<span class="lineNum">    1055 </span>            : 
<span class="lineNum">    1056 </span>            :   // Returns the standard listener responsible for the default XML output
<span class="lineNum">    1057 </span>            :   // controlled by the --gtest_output=xml flag.  Can be removed from the
<span class="lineNum">    1058 </span>            :   // listeners list by users who want to shut down the default XML output
<span class="lineNum">    1059 </span>            :   // controlled by this flag and substitute it with custom one.  Note that
<span class="lineNum">    1060 </span>            :   // removing this object from the listener list with Release transfers its
<span class="lineNum">    1061 </span>            :   // ownership to the caller and makes this function return NULL the next
<span class="lineNum">    1062 </span>            :   // time.
<span class="lineNum">    1063 </span>            :   TestEventListener* default_xml_generator() const {
<span class="lineNum">    1064 </span>            :     return default_xml_generator_;
<span class="lineNum">    1065 </span>            :   }
<span class="lineNum">    1066 </span>            : 
<span class="lineNum">    1067 </span>            :  private:
<span class="lineNum">    1068 </span>            :   friend class TestCase;
<span class="lineNum">    1069 </span>            :   friend class TestInfo;
<span class="lineNum">    1070 </span>            :   friend class internal::DefaultGlobalTestPartResultReporter;
<span class="lineNum">    1071 </span>            :   friend class internal::NoExecDeathTest;
<span class="lineNum">    1072 </span>            :   friend class internal::TestEventListenersAccessor;
<span class="lineNum">    1073 </span>            :   friend class internal::UnitTestImpl;
<span class="lineNum">    1074 </span>            : 
<span class="lineNum">    1075 </span>            :   // Returns repeater that broadcasts the TestEventListener events to all
<span class="lineNum">    1076 </span>            :   // subscribers.
<span class="lineNum">    1077 </span>            :   TestEventListener* repeater();
<span class="lineNum">    1078 </span>            : 
<span class="lineNum">    1079 </span>            :   // Sets the default_result_printer attribute to the provided listener.
<span class="lineNum">    1080 </span>            :   // The listener is also added to the listener list and previous
<span class="lineNum">    1081 </span>            :   // default_result_printer is removed from it and deleted. The listener can
<span class="lineNum">    1082 </span>            :   // also be NULL in which case it will not be added to the list. Does
<span class="lineNum">    1083 </span>            :   // nothing if the previous and the current listener objects are the same.
<span class="lineNum">    1084 </span>            :   void SetDefaultResultPrinter(TestEventListener* listener);
<span class="lineNum">    1085 </span>            : 
<span class="lineNum">    1086 </span>            :   // Sets the default_xml_generator attribute to the provided listener.  The
<span class="lineNum">    1087 </span>            :   // listener is also added to the listener list and previous
<span class="lineNum">    1088 </span>            :   // default_xml_generator is removed from it and deleted. The listener can
<span class="lineNum">    1089 </span>            :   // also be NULL in which case it will not be added to the list. Does
<span class="lineNum">    1090 </span>            :   // nothing if the previous and the current listener objects are the same.
<span class="lineNum">    1091 </span>            :   void SetDefaultXmlGenerator(TestEventListener* listener);
<span class="lineNum">    1092 </span>            : 
<span class="lineNum">    1093 </span>            :   // Controls whether events will be forwarded by the repeater to the
<span class="lineNum">    1094 </span>            :   // listeners in the list.
<span class="lineNum">    1095 </span>            :   bool EventForwardingEnabled() const;
<span class="lineNum">    1096 </span>            :   void SuppressEventForwarding();
<span class="lineNum">    1097 </span>            : 
<span class="lineNum">    1098 </span>            :   // The actual list of listeners.
<span class="lineNum">    1099 </span>            :   internal::TestEventRepeater* repeater_;
<span class="lineNum">    1100 </span>            :   // Listener responsible for the standard result output.
<span class="lineNum">    1101 </span>            :   TestEventListener* default_result_printer_;
<span class="lineNum">    1102 </span>            :   // Listener responsible for the creation of the XML output file.
<span class="lineNum">    1103 </span>            :   TestEventListener* default_xml_generator_;
<span class="lineNum">    1104 </span>            : 
<span class="lineNum">    1105 </span>            :   // We disallow copying TestEventListeners.
<span class="lineNum">    1106 </span>            :   GTEST_DISALLOW_COPY_AND_ASSIGN_(TestEventListeners);
<span class="lineNum">    1107 </span>            : };
<span class="lineNum">    1108 </span>            : 
<span class="lineNum">    1109 </span>            : // A UnitTest consists of a vector of TestCases.
<span class="lineNum">    1110 </span>            : //
<span class="lineNum">    1111 </span>            : // This is a singleton class.  The only instance of UnitTest is
<span class="lineNum">    1112 </span>            : // created when UnitTest::GetInstance() is first called.  This
<span class="lineNum">    1113 </span>            : // instance is never deleted.
<span class="lineNum">    1114 </span>            : //
<span class="lineNum">    1115 </span>            : // UnitTest is not copyable.
<span class="lineNum">    1116 </span>            : //
<span class="lineNum">    1117 </span>            : // This class is thread-safe as long as the methods are called
<span class="lineNum">    1118 </span>            : // according to their specification.
<span class="lineNum">    1119 </span>            : class GTEST_API_ UnitTest {
<span class="lineNum">    1120 </span>            :  public:
<span class="lineNum">    1121 </span>            :   // Gets the singleton UnitTest object.  The first time this method
<span class="lineNum">    1122 </span>            :   // is called, a UnitTest object is constructed and returned.
<span class="lineNum">    1123 </span>            :   // Consecutive calls will return the same object.
<span class="lineNum">    1124 </span>            :   static UnitTest* GetInstance();
<span class="lineNum">    1125 </span>            : 
<span class="lineNum">    1126 </span>            :   // Runs all tests in this UnitTest object and prints the result.
<span class="lineNum">    1127 </span>            :   // Returns 0 if successful, or 1 otherwise.
<span class="lineNum">    1128 </span>            :   //
<span class="lineNum">    1129 </span>            :   // This method can only be called from the main thread.
<span class="lineNum">    1130 </span>            :   //
<span class="lineNum">    1131 </span>            :   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1132 </span>            :   int Run() GTEST_MUST_USE_RESULT_;
<span class="lineNum">    1133 </span>            : 
<span class="lineNum">    1134 </span>            :   // Returns the working directory when the first TEST() or TEST_F()
<span class="lineNum">    1135 </span>            :   // was executed.  The UnitTest object owns the string.
<span class="lineNum">    1136 </span>            :   const char* original_working_dir() const;
<span class="lineNum">    1137 </span>            : 
<span class="lineNum">    1138 </span>            :   // Returns the TestCase object for the test that's currently running,
<span class="lineNum">    1139 </span>            :   // or NULL if no test is running.
<span class="lineNum">    1140 </span>            :   const TestCase* current_test_case() const
<span class="lineNum">    1141 </span>            :       GTEST_LOCK_EXCLUDED_(mutex_);
<span class="lineNum">    1142 </span>            : 
<span class="lineNum">    1143 </span>            :   // Returns the TestInfo object for the test that's currently running,
<span class="lineNum">    1144 </span>            :   // or NULL if no test is running.
<span class="lineNum">    1145 </span>            :   const TestInfo* current_test_info() const
<span class="lineNum">    1146 </span>            :       GTEST_LOCK_EXCLUDED_(mutex_);
<span class="lineNum">    1147 </span>            : 
<span class="lineNum">    1148 </span>            :   // Returns the random seed used at the start of the current test run.
<span class="lineNum">    1149 </span>            :   int random_seed() const;
<span class="lineNum">    1150 </span>            : 
<span class="lineNum">    1151 </span>            : #if GTEST_HAS_PARAM_TEST
<span class="lineNum">    1152 </span>            :   // Returns the ParameterizedTestCaseRegistry object used to keep track of
<span class="lineNum">    1153 </span>            :   // value-parameterized tests and instantiate and register them.
<span class="lineNum">    1154 </span>            :   //
<span class="lineNum">    1155 </span>            :   // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1156 </span>            :   internal::ParameterizedTestCaseRegistry&amp; parameterized_test_registry()
<span class="lineNum">    1157 </span>            :       GTEST_LOCK_EXCLUDED_(mutex_);
<span class="lineNum">    1158 </span>            : #endif  // GTEST_HAS_PARAM_TEST
<span class="lineNum">    1159 </span>            : 
<span class="lineNum">    1160 </span>            :   // Gets the number of successful test cases.
<span class="lineNum">    1161 </span>            :   int successful_test_case_count() const;
<span class="lineNum">    1162 </span>            : 
<span class="lineNum">    1163 </span>            :   // Gets the number of failed test cases.
<span class="lineNum">    1164 </span>            :   int failed_test_case_count() const;
<span class="lineNum">    1165 </span>            : 
<span class="lineNum">    1166 </span>            :   // Gets the number of all test cases.
<span class="lineNum">    1167 </span>            :   int total_test_case_count() const;
<span class="lineNum">    1168 </span>            : 
<span class="lineNum">    1169 </span>            :   // Gets the number of all test cases that contain at least one test
<span class="lineNum">    1170 </span>            :   // that should run.
<span class="lineNum">    1171 </span>            :   int test_case_to_run_count() const;
<span class="lineNum">    1172 </span>            : 
<span class="lineNum">    1173 </span>            :   // Gets the number of successful tests.
<span class="lineNum">    1174 </span>            :   int successful_test_count() const;
<span class="lineNum">    1175 </span>            : 
<span class="lineNum">    1176 </span>            :   // Gets the number of failed tests.
<span class="lineNum">    1177 </span>            :   int failed_test_count() const;
<span class="lineNum">    1178 </span>            : 
<span class="lineNum">    1179 </span>            :   // Gets the number of disabled tests that will be reported in the XML report.
<span class="lineNum">    1180 </span>            :   int reportable_disabled_test_count() const;
<span class="lineNum">    1181 </span>            : 
<span class="lineNum">    1182 </span>            :   // Gets the number of disabled tests.
<span class="lineNum">    1183 </span>            :   int disabled_test_count() const;
<span class="lineNum">    1184 </span>            : 
<span class="lineNum">    1185 </span>            :   // Gets the number of tests to be printed in the XML report.
<span class="lineNum">    1186 </span>            :   int reportable_test_count() const;
<span class="lineNum">    1187 </span>            : 
<span class="lineNum">    1188 </span>            :   // Gets the number of all tests.
<span class="lineNum">    1189 </span>            :   int total_test_count() const;
<span class="lineNum">    1190 </span>            : 
<span class="lineNum">    1191 </span>            :   // Gets the number of tests that should run.
<span class="lineNum">    1192 </span>            :   int test_to_run_count() const;
<span class="lineNum">    1193 </span>            : 
<span class="lineNum">    1194 </span>            :   // Gets the time of the test program start, in ms from the start of the
<span class="lineNum">    1195 </span>            :   // UNIX epoch.
<span class="lineNum">    1196 </span>            :   TimeInMillis start_timestamp() const;
<span class="lineNum">    1197 </span>            : 
<span class="lineNum">    1198 </span>            :   // Gets the elapsed time, in milliseconds.
<span class="lineNum">    1199 </span>            :   TimeInMillis elapsed_time() const;
<span class="lineNum">    1200 </span>            : 
<span class="lineNum">    1201 </span>            :   // Returns true iff the unit test passed (i.e. all test cases passed).
<span class="lineNum">    1202 </span>            :   bool Passed() const;
<span class="lineNum">    1203 </span>            : 
<span class="lineNum">    1204 </span>            :   // Returns true iff the unit test failed (i.e. some test case failed
<span class="lineNum">    1205 </span>            :   // or something outside of all tests failed).
<span class="lineNum">    1206 </span>            :   bool Failed() const;
<span class="lineNum">    1207 </span>            : 
<span class="lineNum">    1208 </span>            :   // Gets the i-th test case among all the test cases. i can range from 0 to
<span class="lineNum">    1209 </span>            :   // total_test_case_count() - 1. If i is not in that range, returns NULL.
<span class="lineNum">    1210 </span>            :   const TestCase* GetTestCase(int i) const;
<span class="lineNum">    1211 </span>            : 
<span class="lineNum">    1212 </span>            :   // Returns the TestResult containing information on test failures and
<span class="lineNum">    1213 </span>            :   // properties logged outside of individual test cases.
<span class="lineNum">    1214 </span>            :   const TestResult&amp; ad_hoc_test_result() const;
<span class="lineNum">    1215 </span>            : 
<span class="lineNum">    1216 </span>            :   // Returns the list of event listeners that can be used to track events
<span class="lineNum">    1217 </span>            :   // inside Google Test.
<span class="lineNum">    1218 </span>            :   TestEventListeners&amp; listeners();
<span class="lineNum">    1219 </span>            : 
<span class="lineNum">    1220 </span>            :  private:
<span class="lineNum">    1221 </span>            :   // Registers and returns a global test environment.  When a test
<span class="lineNum">    1222 </span>            :   // program is run, all global test environments will be set-up in
<span class="lineNum">    1223 </span>            :   // the order they were registered.  After all tests in the program
<span class="lineNum">    1224 </span>            :   // have finished, all global test environments will be torn-down in
<span class="lineNum">    1225 </span>            :   // the *reverse* order they were registered.
<span class="lineNum">    1226 </span>            :   //
<span class="lineNum">    1227 </span>            :   // The UnitTest object takes ownership of the given environment.
<span class="lineNum">    1228 </span>            :   //
<span class="lineNum">    1229 </span>            :   // This method can only be called from the main thread.
<span class="lineNum">    1230 </span>            :   Environment* AddEnvironment(Environment* env);
<span class="lineNum">    1231 </span>            : 
<span class="lineNum">    1232 </span>            :   // Adds a TestPartResult to the current TestResult object.  All
<span class="lineNum">    1233 </span>            :   // Google Test assertion macros (e.g. ASSERT_TRUE, EXPECT_EQ, etc)
<span class="lineNum">    1234 </span>            :   // eventually call this to report their results.  The user code
<span class="lineNum">    1235 </span>            :   // should use the assertion macros instead of calling this directly.
<span class="lineNum">    1236 </span>            :   void AddTestPartResult(TestPartResult::Type result_type,
<span class="lineNum">    1237 </span>            :                          const char* file_name,
<span class="lineNum">    1238 </span>            :                          int line_number,
<span class="lineNum">    1239 </span>            :                          const std::string&amp; message,
<span class="lineNum">    1240 </span>            :                          const std::string&amp; os_stack_trace)
<span class="lineNum">    1241 </span>            :       GTEST_LOCK_EXCLUDED_(mutex_);
<span class="lineNum">    1242 </span>            : 
<span class="lineNum">    1243 </span>            :   // Adds a TestProperty to the current TestResult object when invoked from
<span class="lineNum">    1244 </span>            :   // inside a test, to current TestCase's ad_hoc_test_result_ when invoked
<span class="lineNum">    1245 </span>            :   // from SetUpTestCase or TearDownTestCase, or to the global property set
<span class="lineNum">    1246 </span>            :   // when invoked elsewhere.  If the result already contains a property with
<span class="lineNum">    1247 </span>            :   // the same key, the value will be updated.
<span class="lineNum">    1248 </span>            :   void RecordProperty(const std::string&amp; key, const std::string&amp; value);
<span class="lineNum">    1249 </span>            : 
<span class="lineNum">    1250 </span>            :   // Gets the i-th test case among all the test cases. i can range from 0 to
<span class="lineNum">    1251 </span>            :   // total_test_case_count() - 1. If i is not in that range, returns NULL.
<span class="lineNum">    1252 </span>            :   TestCase* GetMutableTestCase(int i);
<a name="1253"><span class="lineNum">    1253 </span>            : </a>
<a name="1254"><span class="lineNum">    1254 </span>            :   // Accessors for the implementation object.</a>
<span class="lineNum">    1255 </span><span class="lineNoCov">          0 :   internal::UnitTestImpl* impl() { return impl_; }</span>
<span class="lineNum">    1256 </span><span class="lineNoCov">          0 :   const internal::UnitTestImpl* impl() const { return impl_; }</span>
<span class="lineNum">    1257 </span>            : 
<span class="lineNum">    1258 </span>            :   // These classes and funcions are friends as they need to access private
<span class="lineNum">    1259 </span>            :   // members of UnitTest.
<span class="lineNum">    1260 </span>            :   friend class Test;
<span class="lineNum">    1261 </span>            :   friend class internal::AssertHelper;
<span class="lineNum">    1262 </span>            :   friend class internal::ScopedTrace;
<span class="lineNum">    1263 </span>            :   friend class internal::StreamingListenerTest;
<span class="lineNum">    1264 </span>            :   friend class internal::UnitTestRecordPropertyTestHelper;
<span class="lineNum">    1265 </span>            :   friend Environment* AddGlobalTestEnvironment(Environment* env);
<span class="lineNum">    1266 </span>            :   friend internal::UnitTestImpl* internal::GetUnitTestImpl();
<span class="lineNum">    1267 </span>            :   friend void internal::ReportFailureInUnknownLocation(
<span class="lineNum">    1268 </span>            :       TestPartResult::Type result_type,
<span class="lineNum">    1269 </span>            :       const std::string&amp; message);
<span class="lineNum">    1270 </span>            : 
<span class="lineNum">    1271 </span>            :   // Creates an empty UnitTest.
<span class="lineNum">    1272 </span>            :   UnitTest();
<span class="lineNum">    1273 </span>            : 
<span class="lineNum">    1274 </span>            :   // D'tor
<span class="lineNum">    1275 </span>            :   virtual ~UnitTest();
<span class="lineNum">    1276 </span>            : 
<span class="lineNum">    1277 </span>            :   // Pushes a trace defined by SCOPED_TRACE() on to the per-thread
<span class="lineNum">    1278 </span>            :   // Google Test trace stack.
<span class="lineNum">    1279 </span>            :   void PushGTestTrace(const internal::TraceInfo&amp; trace)
<span class="lineNum">    1280 </span>            :       GTEST_LOCK_EXCLUDED_(mutex_);
<span class="lineNum">    1281 </span>            : 
<span class="lineNum">    1282 </span>            :   // Pops a trace from the per-thread Google Test trace stack.
<span class="lineNum">    1283 </span>            :   void PopGTestTrace()
<span class="lineNum">    1284 </span>            :       GTEST_LOCK_EXCLUDED_(mutex_);
<span class="lineNum">    1285 </span>            : 
<span class="lineNum">    1286 </span>            :   // Protects mutable state in *impl_.  This is mutable as some const
<span class="lineNum">    1287 </span>            :   // methods need to lock it too.
<span class="lineNum">    1288 </span>            :   mutable internal::Mutex mutex_;
<span class="lineNum">    1289 </span>            : 
<span class="lineNum">    1290 </span>            :   // Opaque implementation object.  This field is never changed once
<span class="lineNum">    1291 </span>            :   // the object is constructed.  We don't mark it as const here, as
<span class="lineNum">    1292 </span>            :   // doing so will cause a warning in the constructor of UnitTest.
<span class="lineNum">    1293 </span>            :   // Mutable state in *impl_ is protected by mutex_.
<span class="lineNum">    1294 </span>            :   internal::UnitTestImpl* impl_;
<span class="lineNum">    1295 </span>            : 
<span class="lineNum">    1296 </span>            :   // We disallow copying UnitTest.
<span class="lineNum">    1297 </span>            :   GTEST_DISALLOW_COPY_AND_ASSIGN_(UnitTest);
<span class="lineNum">    1298 </span>            : };
<span class="lineNum">    1299 </span>            : 
<span class="lineNum">    1300 </span>            : // A convenient wrapper for adding an environment for the test
<span class="lineNum">    1301 </span>            : // program.
<span class="lineNum">    1302 </span>            : //
<span class="lineNum">    1303 </span>            : // You should call this before RUN_ALL_TESTS() is called, probably in
<span class="lineNum">    1304 </span>            : // main().  If you use gtest_main, you need to call this before main()
<span class="lineNum">    1305 </span>            : // starts for it to take effect.  For example, you can define a global
<span class="lineNum">    1306 </span>            : // variable like this:
<span class="lineNum">    1307 </span>            : //
<span class="lineNum">    1308 </span>            : //   testing::Environment* const foo_env =
<span class="lineNum">    1309 </span>            : //       testing::AddGlobalTestEnvironment(new FooEnvironment);
<span class="lineNum">    1310 </span>            : //
<span class="lineNum">    1311 </span>            : // However, we strongly recommend you to write your own main() and
<span class="lineNum">    1312 </span>            : // call AddGlobalTestEnvironment() there, as relying on initialization
<span class="lineNum">    1313 </span>            : // of global variables makes the code harder to read and may cause
<span class="lineNum">    1314 </span>            : // problems when you register multiple environments from different
<span class="lineNum">    1315 </span>            : // translation units and the environments have dependencies among them
<span class="lineNum">    1316 </span>            : // (remember that the compiler doesn't guarantee the order in which
<span class="lineNum">    1317 </span>            : // global variables from different translation units are initialized).
<span class="lineNum">    1318 </span>            : inline Environment* AddGlobalTestEnvironment(Environment* env) {
<span class="lineNum">    1319 </span>            :   return UnitTest::GetInstance()-&gt;AddEnvironment(env);
<span class="lineNum">    1320 </span>            : }
<span class="lineNum">    1321 </span>            : 
<span class="lineNum">    1322 </span>            : // Initializes Google Test.  This must be called before calling
<span class="lineNum">    1323 </span>            : // RUN_ALL_TESTS().  In particular, it parses a command line for the
<span class="lineNum">    1324 </span>            : // flags that Google Test recognizes.  Whenever a Google Test flag is
<span class="lineNum">    1325 </span>            : // seen, it is removed from argv, and *argc is decremented.
<span class="lineNum">    1326 </span>            : //
<span class="lineNum">    1327 </span>            : // No value is returned.  Instead, the Google Test flag variables are
<span class="lineNum">    1328 </span>            : // updated.
<span class="lineNum">    1329 </span>            : //
<span class="lineNum">    1330 </span>            : // Calling the function for the second time has no user-visible effect.
<span class="lineNum">    1331 </span>            : GTEST_API_ void InitGoogleTest(int* argc, char** argv);
<span class="lineNum">    1332 </span>            : 
<span class="lineNum">    1333 </span>            : // This overloaded version can be used in Windows programs compiled in
<span class="lineNum">    1334 </span>            : // UNICODE mode.
<span class="lineNum">    1335 </span>            : GTEST_API_ void InitGoogleTest(int* argc, wchar_t** argv);
<span class="lineNum">    1336 </span>            : 
<span class="lineNum">    1337 </span>            : namespace internal {
<span class="lineNum">    1338 </span>            : 
<span class="lineNum">    1339 </span>            : // FormatForComparison&lt;ToPrint, OtherOperand&gt;::Format(value) formats a
<span class="lineNum">    1340 </span>            : // value of type ToPrint that is an operand of a comparison assertion
<span class="lineNum">    1341 </span>            : // (e.g. ASSERT_EQ).  OtherOperand is the type of the other operand in
<span class="lineNum">    1342 </span>            : // the comparison, and is used to help determine the best way to
<span class="lineNum">    1343 </span>            : // format the value.  In particular, when the value is a C string
<span class="lineNum">    1344 </span>            : // (char pointer) and the other operand is an STL string object, we
<span class="lineNum">    1345 </span>            : // want to format the C string as a string, since we know it is
<span class="lineNum">    1346 </span>            : // compared by value with the string object.  If the value is a char
<span class="lineNum">    1347 </span>            : // pointer but the other operand is not an STL string object, we don't
<span class="lineNum">    1348 </span>            : // know whether the pointer is supposed to point to a NUL-terminated
<span class="lineNum">    1349 </span>            : // string, and thus want to print it as a pointer to be safe.
<span class="lineNum">    1350 </span>            : //
<span class="lineNum">    1351 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1352 </span>            : 
<span class="lineNum">    1353 </span>            : // The default case.
<span class="lineNum">    1354 </span>            : template &lt;typename ToPrint, typename OtherOperand&gt;
<a name="1355"><span class="lineNum">    1355 </span>            : class FormatForComparison {</a>
<span class="lineNum">    1356 </span>            :  public:
<span class="lineNum">    1357 </span><span class="lineNoCov">          0 :   static ::std::string Format(const ToPrint&amp; value) {</span>
<span class="lineNum">    1358 </span><span class="lineNoCov">          0 :     return ::testing::PrintToString(value);</span>
<span class="lineNum">    1359 </span>            :   }
<span class="lineNum">    1360 </span>            : };
<span class="lineNum">    1361 </span>            : 
<span class="lineNum">    1362 </span>            : // Array.
<span class="lineNum">    1363 </span>            : template &lt;typename ToPrint, size_t N, typename OtherOperand&gt;
<a name="1364"><span class="lineNum">    1364 </span>            : class FormatForComparison&lt;ToPrint[N], OtherOperand&gt; {</a>
<span class="lineNum">    1365 </span>            :  public:
<span class="lineNum">    1366 </span><span class="lineNoCov">          0 :   static ::std::string Format(const ToPrint* value) {</span>
<span class="lineNum">    1367 </span><span class="lineNoCov">          0 :     return FormatForComparison&lt;const ToPrint*, OtherOperand&gt;::Format(value);</span>
<span class="lineNum">    1368 </span>            :   }
<span class="lineNum">    1369 </span>            : };
<span class="lineNum">    1370 </span>            : 
<span class="lineNum">    1371 </span>            : // By default, print C string as pointers to be safe, as we don't know
<span class="lineNum">    1372 </span>            : // whether they actually point to a NUL-terminated string.
<span class="lineNum">    1373 </span>            : 
<span class="lineNum">    1374 </span>            : #define GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(CharType)                \
<span class="lineNum">    1375 </span>            :   template &lt;typename OtherOperand&gt;                                      \
<span class="lineNum">    1376 </span>            :   class FormatForComparison&lt;CharType*, OtherOperand&gt; {                  \
<span class="lineNum">    1377 </span>            :    public:                                                              \
<span class="lineNum">    1378 </span>            :     static ::std::string Format(CharType* value) {                      \
<span class="lineNum">    1379 </span>            :       return ::testing::PrintToString(static_cast&lt;const void*&gt;(value)); \
<span class="lineNum">    1380 </span>            :     }                                                                   \
<span class="lineNum">    1381 </span>            :   }
<span class="lineNum">    1382 </span>            : 
<span class="lineNum">    1383 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(char);
<span class="lineNum">    1384 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const char);
<span class="lineNum">    1385 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(wchar_t);
<span class="lineNum">    1386 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_(const wchar_t);
<span class="lineNum">    1387 </span>            : 
<span class="lineNum">    1388 </span>            : #undef GTEST_IMPL_FORMAT_C_STRING_AS_POINTER_
<span class="lineNum">    1389 </span>            : 
<span class="lineNum">    1390 </span>            : // If a C string is compared with an STL string object, we know it's meant
<span class="lineNum">    1391 </span>            : // to point to a NUL-terminated string, and thus can print it as a string.
<span class="lineNum">    1392 </span>            : 
<span class="lineNum">    1393 </span>            : #define GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(CharType, OtherStringType) \
<span class="lineNum">    1394 </span>            :   template &lt;&gt;                                                           \
<span class="lineNum">    1395 </span>            :   class FormatForComparison&lt;CharType*, OtherStringType&gt; {               \
<span class="lineNum">    1396 </span>            :    public:                                                              \
<span class="lineNum">    1397 </span>            :     static ::std::string Format(CharType* value) {                      \
<span class="lineNum">    1398 </span>            :       return ::testing::PrintToString(value);                           \
<span class="lineNum">    1399 </span>            :     }                                                                   \
<span class="lineNum">    1400 </span>            :   }
<a name="1401"><span class="lineNum">    1401 </span>            : </a>
<span class="lineNum">    1402 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::std::string);
<span class="lineNum">    1403 </span><span class="lineNoCov">          0 : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::std::string);</span>
<span class="lineNum">    1404 </span>            : 
<span class="lineNum">    1405 </span>            : #if GTEST_HAS_GLOBAL_STRING
<span class="lineNum">    1406 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(char, ::string);
<span class="lineNum">    1407 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const char, ::string);
<span class="lineNum">    1408 </span>            : #endif
<span class="lineNum">    1409 </span>            : 
<span class="lineNum">    1410 </span>            : #if GTEST_HAS_GLOBAL_WSTRING
<span class="lineNum">    1411 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::wstring);
<span class="lineNum">    1412 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::wstring);
<span class="lineNum">    1413 </span>            : #endif
<span class="lineNum">    1414 </span>            : 
<span class="lineNum">    1415 </span>            : #if GTEST_HAS_STD_WSTRING
<span class="lineNum">    1416 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(wchar_t, ::std::wstring);
<span class="lineNum">    1417 </span>            : GTEST_IMPL_FORMAT_C_STRING_AS_STRING_(const wchar_t, ::std::wstring);
<span class="lineNum">    1418 </span>            : #endif
<span class="lineNum">    1419 </span>            : 
<span class="lineNum">    1420 </span>            : #undef GTEST_IMPL_FORMAT_C_STRING_AS_STRING_
<span class="lineNum">    1421 </span>            : 
<span class="lineNum">    1422 </span>            : // Formats a comparison assertion (e.g. ASSERT_EQ, EXPECT_LT, and etc)
<span class="lineNum">    1423 </span>            : // operand to be used in a failure message.  The type (but not value)
<span class="lineNum">    1424 </span>            : // of the other operand may affect the format.  This allows us to
<span class="lineNum">    1425 </span>            : // print a char* as a raw pointer when it is compared against another
<span class="lineNum">    1426 </span>            : // char* or void*, and print it as a C string when it is compared
<span class="lineNum">    1427 </span>            : // against an std::string object, for example.
<span class="lineNum">    1428 </span>            : //
<a name="1429"><span class="lineNum">    1429 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.</a>
<span class="lineNum">    1430 </span>            : template &lt;typename T1, typename T2&gt;
<span class="lineNum">    1431 </span><span class="lineNoCov">          0 : std::string FormatForComparisonFailureMessage(</span>
<span class="lineNum">    1432 </span>            :     const T1&amp; value, const T2&amp; /* other_operand */) {
<span class="lineNum">    1433 </span><span class="lineNoCov">          0 :   return FormatForComparison&lt;T1, T2&gt;::Format(value);</span>
<span class="lineNum">    1434 </span>            : }
<span class="lineNum">    1435 </span>            : 
<a name="1436"><span class="lineNum">    1436 </span>            : // The helper function for {ASSERT|EXPECT}_EQ.</a>
<span class="lineNum">    1437 </span>            : template &lt;typename T1, typename T2&gt;
<span class="lineNum">    1438 </span><span class="lineNoCov">          0 : AssertionResult CmpHelperEQ(const char* expected_expression,</span>
<span class="lineNum">    1439 </span>            :                             const char* actual_expression,
<span class="lineNum">    1440 </span>            :                             const T1&amp; expected,
<span class="lineNum">    1441 </span>            :                             const T2&amp; actual) {
<span class="lineNum">    1442 </span>            : #ifdef _MSC_VER
<span class="lineNum">    1443 </span>            : # pragma warning(push)          // Saves the current warning state.
<span class="lineNum">    1444 </span>            : # pragma warning(disable:4389)  // Temporarily disables warning on
<span class="lineNum">    1445 </span>            :                                 // signed/unsigned mismatch.
<span class="lineNum">    1446 </span>            : #endif
<span class="lineNum">    1447 </span>            : 
<span class="lineNum">    1448 </span><span class="lineNoCov">          0 :   if (expected == actual) {</span>
<span class="lineNum">    1449 </span><span class="lineNoCov">          0 :     return AssertionSuccess();</span>
<span class="lineNum">    1450 </span>            :   }
<span class="lineNum">    1451 </span>            : 
<span class="lineNum">    1452 </span>            : #ifdef _MSC_VER
<span class="lineNum">    1453 </span>            : # pragma warning(pop)          // Restores the warning state.
<span class="lineNum">    1454 </span>            : #endif
<span class="lineNum">    1455 </span>            : 
<span class="lineNum">    1456 </span>            :   return EqFailure(expected_expression,
<span class="lineNum">    1457 </span>            :                    actual_expression,
<span class="lineNum">    1458 </span>            :                    FormatForComparisonFailureMessage(expected, actual),
<span class="lineNum">    1459 </span>            :                    FormatForComparisonFailureMessage(actual, expected),
<span class="lineNum">    1460 </span><span class="lineNoCov">          0 :                    false);</span>
<span class="lineNum">    1461 </span>            : }
<span class="lineNum">    1462 </span>            : 
<span class="lineNum">    1463 </span>            : // With this overloaded version, we allow anonymous enums to be used
<span class="lineNum">    1464 </span>            : // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous enums
<span class="lineNum">    1465 </span>            : // can be implicitly cast to BiggestInt.
<span class="lineNum">    1466 </span>            : GTEST_API_ AssertionResult CmpHelperEQ(const char* expected_expression,
<span class="lineNum">    1467 </span>            :                                        const char* actual_expression,
<span class="lineNum">    1468 </span>            :                                        BiggestInt expected,
<span class="lineNum">    1469 </span>            :                                        BiggestInt actual);
<span class="lineNum">    1470 </span>            : 
<span class="lineNum">    1471 </span>            : // The helper class for {ASSERT|EXPECT}_EQ.  The template argument
<span class="lineNum">    1472 </span>            : // lhs_is_null_literal is true iff the first argument to ASSERT_EQ()
<span class="lineNum">    1473 </span>            : // is a null pointer literal.  The following default implementation is
<span class="lineNum">    1474 </span>            : // for lhs_is_null_literal being false.
<span class="lineNum">    1475 </span>            : template &lt;bool lhs_is_null_literal&gt;
<span class="lineNum">    1476 </span>            : class EqHelper {
<span class="lineNum">    1477 </span>            :  public:
<a name="1478"><span class="lineNum">    1478 </span>            :   // This templatized version is for the general case.</a>
<span class="lineNum">    1479 </span>            :   template &lt;typename T1, typename T2&gt;
<span class="lineNum">    1480 </span><span class="lineNoCov">          0 :   static AssertionResult Compare(const char* expected_expression,</span>
<span class="lineNum">    1481 </span>            :                                  const char* actual_expression,
<span class="lineNum">    1482 </span>            :                                  const T1&amp; expected,
<span class="lineNum">    1483 </span>            :                                  const T2&amp; actual) {
<span class="lineNum">    1484 </span>            :     return CmpHelperEQ(expected_expression, actual_expression, expected,
<span class="lineNum">    1485 </span><span class="lineNoCov">          0 :                        actual);</span>
<span class="lineNum">    1486 </span>            :   }
<span class="lineNum">    1487 </span>            : 
<span class="lineNum">    1488 </span>            :   // With this overloaded version, we allow anonymous enums to be used
<span class="lineNum">    1489 </span>            :   // in {ASSERT|EXPECT}_EQ when compiled with gcc 4, as anonymous
<span class="lineNum">    1490 </span>            :   // enums can be implicitly cast to BiggestInt.
<span class="lineNum">    1491 </span>            :   //
<span class="lineNum">    1492 </span>            :   // Even though its body looks the same as the above version, we
<span class="lineNum">    1493 </span>            :   // cannot merge the two, as it will make anonymous enums unhappy.
<span class="lineNum">    1494 </span>            :   static AssertionResult Compare(const char* expected_expression,
<span class="lineNum">    1495 </span>            :                                  const char* actual_expression,
<span class="lineNum">    1496 </span>            :                                  BiggestInt expected,
<span class="lineNum">    1497 </span>            :                                  BiggestInt actual) {
<span class="lineNum">    1498 </span>            :     return CmpHelperEQ(expected_expression, actual_expression, expected,
<span class="lineNum">    1499 </span>            :                        actual);
<span class="lineNum">    1500 </span>            :   }
<span class="lineNum">    1501 </span>            : };
<span class="lineNum">    1502 </span>            : 
<span class="lineNum">    1503 </span>            : // This specialization is used when the first argument to ASSERT_EQ()
<span class="lineNum">    1504 </span>            : // is a null pointer literal, like NULL, false, or 0.
<span class="lineNum">    1505 </span>            : template &lt;&gt;
<span class="lineNum">    1506 </span>            : class EqHelper&lt;true&gt; {
<span class="lineNum">    1507 </span>            :  public:
<span class="lineNum">    1508 </span>            :   // We define two overloaded versions of Compare().  The first
<span class="lineNum">    1509 </span>            :   // version will be picked when the second argument to ASSERT_EQ() is
<span class="lineNum">    1510 </span>            :   // NOT a pointer, e.g. ASSERT_EQ(0, AnIntFunction()) or
<a name="1511"><span class="lineNum">    1511 </span>            :   // EXPECT_EQ(false, a_bool).</a>
<span class="lineNum">    1512 </span>            :   template &lt;typename T1, typename T2&gt;
<span class="lineNum">    1513 </span><span class="lineNoCov">          0 :   static AssertionResult Compare(</span>
<span class="lineNum">    1514 </span>            :       const char* expected_expression,
<span class="lineNum">    1515 </span>            :       const char* actual_expression,
<span class="lineNum">    1516 </span>            :       const T1&amp; expected,
<span class="lineNum">    1517 </span>            :       const T2&amp; actual,
<span class="lineNum">    1518 </span>            :       // The following line prevents this overload from being considered if T2
<span class="lineNum">    1519 </span>            :       // is not a pointer type.  We need this because ASSERT_EQ(NULL, my_ptr)
<span class="lineNum">    1520 </span>            :       // expands to Compare(&quot;&quot;, &quot;&quot;, NULL, my_ptr), which requires a conversion
<span class="lineNum">    1521 </span>            :       // to match the Secret* in the other overload, which would otherwise make
<span class="lineNum">    1522 </span>            :       // this template match better.
<span class="lineNum">    1523 </span>            :       typename EnableIf&lt;!is_pointer&lt;T2&gt;::value&gt;::type* = 0) {
<span class="lineNum">    1524 </span>            :     return CmpHelperEQ(expected_expression, actual_expression, expected,
<span class="lineNum">    1525 </span><span class="lineNoCov">          0 :                        actual);</span>
<span class="lineNum">    1526 </span>            :   }
<span class="lineNum">    1527 </span>            : 
<span class="lineNum">    1528 </span>            :   // This version will be picked when the second argument to ASSERT_EQ() is a
<span class="lineNum">    1529 </span>            :   // pointer, e.g. ASSERT_EQ(NULL, a_pointer).
<span class="lineNum">    1530 </span>            :   template &lt;typename T&gt;
<span class="lineNum">    1531 </span>            :   static AssertionResult Compare(
<span class="lineNum">    1532 </span>            :       const char* expected_expression,
<span class="lineNum">    1533 </span>            :       const char* actual_expression,
<span class="lineNum">    1534 </span>            :       // We used to have a second template parameter instead of Secret*.  That
<span class="lineNum">    1535 </span>            :       // template parameter would deduce to 'long', making this a better match
<span class="lineNum">    1536 </span>            :       // than the first overload even without the first overload's EnableIf.
<span class="lineNum">    1537 </span>            :       // Unfortunately, gcc with -Wconversion-null warns when &quot;passing NULL to
<span class="lineNum">    1538 </span>            :       // non-pointer argument&quot; (even a deduced integral argument), so the old
<span class="lineNum">    1539 </span>            :       // implementation caused warnings in user code.
<span class="lineNum">    1540 </span>            :       Secret* /* expected (NULL) */,
<span class="lineNum">    1541 </span>            :       T* actual) {
<span class="lineNum">    1542 </span>            :     // We already know that 'expected' is a null pointer.
<span class="lineNum">    1543 </span>            :     return CmpHelperEQ(expected_expression, actual_expression,
<span class="lineNum">    1544 </span>            :                        static_cast&lt;T*&gt;(NULL), actual);
<span class="lineNum">    1545 </span>            :   }
<span class="lineNum">    1546 </span>            : };
<span class="lineNum">    1547 </span>            : 
<span class="lineNum">    1548 </span>            : // A macro for implementing the helper functions needed to implement
<span class="lineNum">    1549 </span>            : // ASSERT_?? and EXPECT_??.  It is here just to avoid copy-and-paste
<span class="lineNum">    1550 </span>            : // of similar code.
<span class="lineNum">    1551 </span>            : //
<span class="lineNum">    1552 </span>            : // For each templatized helper function, we also define an overloaded
<span class="lineNum">    1553 </span>            : // version for BiggestInt in order to reduce code bloat and allow
<span class="lineNum">    1554 </span>            : // anonymous enums to be used with {ASSERT|EXPECT}_?? when compiled
<span class="lineNum">    1555 </span>            : // with gcc 4.
<span class="lineNum">    1556 </span>            : //
<span class="lineNum">    1557 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1558 </span>            : #define GTEST_IMPL_CMP_HELPER_(op_name, op)\
<span class="lineNum">    1559 </span>            : template &lt;typename T1, typename T2&gt;\
<span class="lineNum">    1560 </span>            : AssertionResult CmpHelper##op_name(const char* expr1, const char* expr2, \
<span class="lineNum">    1561 </span>            :                                    const T1&amp; val1, const T2&amp; val2) {\
<span class="lineNum">    1562 </span>            :   if (val1 op val2) {\
<span class="lineNum">    1563 </span>            :     return AssertionSuccess();\
<span class="lineNum">    1564 </span>            :   } else {\
<span class="lineNum">    1565 </span>            :     return AssertionFailure() \
<span class="lineNum">    1566 </span>            :         &lt;&lt; &quot;Expected: (&quot; &lt;&lt; expr1 &lt;&lt; &quot;) &quot; #op &quot; (&quot; &lt;&lt; expr2\
<span class="lineNum">    1567 </span>            :         &lt;&lt; &quot;), actual: &quot; &lt;&lt; FormatForComparisonFailureMessage(val1, val2)\
<span class="lineNum">    1568 </span>            :         &lt;&lt; &quot; vs &quot; &lt;&lt; FormatForComparisonFailureMessage(val2, val1);\
<span class="lineNum">    1569 </span>            :   }\
<span class="lineNum">    1570 </span>            : }\
<span class="lineNum">    1571 </span>            : GTEST_API_ AssertionResult CmpHelper##op_name(\
<span class="lineNum">    1572 </span>            :     const char* expr1, const char* expr2, BiggestInt val1, BiggestInt val2)
<span class="lineNum">    1573 </span>            : 
<span class="lineNum">    1574 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<a name="1575"><span class="lineNum">    1575 </span>            : </a>
<span class="lineNum">    1576 </span>            : // Implements the helper function for {ASSERT|EXPECT}_NE
<span class="lineNum">    1577 </span><span class="lineNoCov">          0 : GTEST_IMPL_CMP_HELPER_(NE, !=);</span>
<span class="lineNum">    1578 </span>            : // Implements the helper function for {ASSERT|EXPECT}_LE
<span class="lineNum">    1579 </span>            : GTEST_IMPL_CMP_HELPER_(LE, &lt;=);
<span class="lineNum">    1580 </span>            : // Implements the helper function for {ASSERT|EXPECT}_LT
<span class="lineNum">    1581 </span>            : GTEST_IMPL_CMP_HELPER_(LT, &lt;);
<span class="lineNum">    1582 </span>            : // Implements the helper function for {ASSERT|EXPECT}_GE
<span class="lineNum">    1583 </span>            : GTEST_IMPL_CMP_HELPER_(GE, &gt;=);
<span class="lineNum">    1584 </span>            : // Implements the helper function for {ASSERT|EXPECT}_GT
<span class="lineNum">    1585 </span>            : GTEST_IMPL_CMP_HELPER_(GT, &gt;);
<span class="lineNum">    1586 </span>            : 
<span class="lineNum">    1587 </span>            : #undef GTEST_IMPL_CMP_HELPER_
<span class="lineNum">    1588 </span>            : 
<span class="lineNum">    1589 </span>            : // The helper function for {ASSERT|EXPECT}_STREQ.
<span class="lineNum">    1590 </span>            : //
<span class="lineNum">    1591 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1592 </span>            : GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
<span class="lineNum">    1593 </span>            :                                           const char* actual_expression,
<span class="lineNum">    1594 </span>            :                                           const char* expected,
<span class="lineNum">    1595 </span>            :                                           const char* actual);
<span class="lineNum">    1596 </span>            : 
<span class="lineNum">    1597 </span>            : // The helper function for {ASSERT|EXPECT}_STRCASEEQ.
<span class="lineNum">    1598 </span>            : //
<span class="lineNum">    1599 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1600 </span>            : GTEST_API_ AssertionResult CmpHelperSTRCASEEQ(const char* expected_expression,
<span class="lineNum">    1601 </span>            :                                               const char* actual_expression,
<span class="lineNum">    1602 </span>            :                                               const char* expected,
<span class="lineNum">    1603 </span>            :                                               const char* actual);
<span class="lineNum">    1604 </span>            : 
<span class="lineNum">    1605 </span>            : // The helper function for {ASSERT|EXPECT}_STRNE.
<span class="lineNum">    1606 </span>            : //
<span class="lineNum">    1607 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1608 </span>            : GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
<span class="lineNum">    1609 </span>            :                                           const char* s2_expression,
<span class="lineNum">    1610 </span>            :                                           const char* s1,
<span class="lineNum">    1611 </span>            :                                           const char* s2);
<span class="lineNum">    1612 </span>            : 
<span class="lineNum">    1613 </span>            : // The helper function for {ASSERT|EXPECT}_STRCASENE.
<span class="lineNum">    1614 </span>            : //
<span class="lineNum">    1615 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1616 </span>            : GTEST_API_ AssertionResult CmpHelperSTRCASENE(const char* s1_expression,
<span class="lineNum">    1617 </span>            :                                               const char* s2_expression,
<span class="lineNum">    1618 </span>            :                                               const char* s1,
<span class="lineNum">    1619 </span>            :                                               const char* s2);
<span class="lineNum">    1620 </span>            : 
<span class="lineNum">    1621 </span>            : 
<span class="lineNum">    1622 </span>            : // Helper function for *_STREQ on wide strings.
<span class="lineNum">    1623 </span>            : //
<span class="lineNum">    1624 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1625 </span>            : GTEST_API_ AssertionResult CmpHelperSTREQ(const char* expected_expression,
<span class="lineNum">    1626 </span>            :                                           const char* actual_expression,
<span class="lineNum">    1627 </span>            :                                           const wchar_t* expected,
<span class="lineNum">    1628 </span>            :                                           const wchar_t* actual);
<span class="lineNum">    1629 </span>            : 
<span class="lineNum">    1630 </span>            : // Helper function for *_STRNE on wide strings.
<span class="lineNum">    1631 </span>            : //
<span class="lineNum">    1632 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1633 </span>            : GTEST_API_ AssertionResult CmpHelperSTRNE(const char* s1_expression,
<span class="lineNum">    1634 </span>            :                                           const char* s2_expression,
<span class="lineNum">    1635 </span>            :                                           const wchar_t* s1,
<span class="lineNum">    1636 </span>            :                                           const wchar_t* s2);
<span class="lineNum">    1637 </span>            : 
<span class="lineNum">    1638 </span>            : }  // namespace internal
<span class="lineNum">    1639 </span>            : 
<span class="lineNum">    1640 </span>            : // IsSubstring() and IsNotSubstring() are intended to be used as the
<span class="lineNum">    1641 </span>            : // first argument to {EXPECT,ASSERT}_PRED_FORMAT2(), not by
<span class="lineNum">    1642 </span>            : // themselves.  They check whether needle is a substring of haystack
<span class="lineNum">    1643 </span>            : // (NULL is considered a substring of itself only), and return an
<span class="lineNum">    1644 </span>            : // appropriate error message when they fail.
<span class="lineNum">    1645 </span>            : //
<span class="lineNum">    1646 </span>            : // The {needle,haystack}_expr arguments are the stringified
<span class="lineNum">    1647 </span>            : // expressions that generated the two real arguments.
<span class="lineNum">    1648 </span>            : GTEST_API_ AssertionResult IsSubstring(
<span class="lineNum">    1649 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1650 </span>            :     const char* needle, const char* haystack);
<span class="lineNum">    1651 </span>            : GTEST_API_ AssertionResult IsSubstring(
<span class="lineNum">    1652 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1653 </span>            :     const wchar_t* needle, const wchar_t* haystack);
<span class="lineNum">    1654 </span>            : GTEST_API_ AssertionResult IsNotSubstring(
<span class="lineNum">    1655 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1656 </span>            :     const char* needle, const char* haystack);
<span class="lineNum">    1657 </span>            : GTEST_API_ AssertionResult IsNotSubstring(
<span class="lineNum">    1658 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1659 </span>            :     const wchar_t* needle, const wchar_t* haystack);
<span class="lineNum">    1660 </span>            : GTEST_API_ AssertionResult IsSubstring(
<span class="lineNum">    1661 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1662 </span>            :     const ::std::string&amp; needle, const ::std::string&amp; haystack);
<span class="lineNum">    1663 </span>            : GTEST_API_ AssertionResult IsNotSubstring(
<span class="lineNum">    1664 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1665 </span>            :     const ::std::string&amp; needle, const ::std::string&amp; haystack);
<span class="lineNum">    1666 </span>            : 
<span class="lineNum">    1667 </span>            : #if GTEST_HAS_STD_WSTRING
<span class="lineNum">    1668 </span>            : GTEST_API_ AssertionResult IsSubstring(
<span class="lineNum">    1669 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1670 </span>            :     const ::std::wstring&amp; needle, const ::std::wstring&amp; haystack);
<span class="lineNum">    1671 </span>            : GTEST_API_ AssertionResult IsNotSubstring(
<span class="lineNum">    1672 </span>            :     const char* needle_expr, const char* haystack_expr,
<span class="lineNum">    1673 </span>            :     const ::std::wstring&amp; needle, const ::std::wstring&amp; haystack);
<span class="lineNum">    1674 </span>            : #endif  // GTEST_HAS_STD_WSTRING
<span class="lineNum">    1675 </span>            : 
<span class="lineNum">    1676 </span>            : namespace internal {
<span class="lineNum">    1677 </span>            : 
<span class="lineNum">    1678 </span>            : // Helper template function for comparing floating-points.
<span class="lineNum">    1679 </span>            : //
<span class="lineNum">    1680 </span>            : // Template parameter:
<span class="lineNum">    1681 </span>            : //
<span class="lineNum">    1682 </span>            : //   RawType: the raw floating-point type (either float or double)
<span class="lineNum">    1683 </span>            : //
<span class="lineNum">    1684 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1685 </span>            : template &lt;typename RawType&gt;
<span class="lineNum">    1686 </span>            : AssertionResult CmpHelperFloatingPointEQ(const char* expected_expression,
<span class="lineNum">    1687 </span>            :                                          const char* actual_expression,
<span class="lineNum">    1688 </span>            :                                          RawType expected,
<span class="lineNum">    1689 </span>            :                                          RawType actual) {
<span class="lineNum">    1690 </span>            :   const FloatingPoint&lt;RawType&gt; lhs(expected), rhs(actual);
<span class="lineNum">    1691 </span>            : 
<span class="lineNum">    1692 </span>            :   if (lhs.AlmostEquals(rhs)) {
<span class="lineNum">    1693 </span>            :     return AssertionSuccess();
<span class="lineNum">    1694 </span>            :   }
<span class="lineNum">    1695 </span>            : 
<span class="lineNum">    1696 </span>            :   ::std::stringstream expected_ss;
<span class="lineNum">    1697 </span>            :   expected_ss &lt;&lt; std::setprecision(std::numeric_limits&lt;RawType&gt;::digits10 + 2)
<span class="lineNum">    1698 </span>            :               &lt;&lt; expected;
<span class="lineNum">    1699 </span>            : 
<span class="lineNum">    1700 </span>            :   ::std::stringstream actual_ss;
<span class="lineNum">    1701 </span>            :   actual_ss &lt;&lt; std::setprecision(std::numeric_limits&lt;RawType&gt;::digits10 + 2)
<span class="lineNum">    1702 </span>            :             &lt;&lt; actual;
<span class="lineNum">    1703 </span>            : 
<span class="lineNum">    1704 </span>            :   return EqFailure(expected_expression,
<span class="lineNum">    1705 </span>            :                    actual_expression,
<span class="lineNum">    1706 </span>            :                    StringStreamToString(&amp;expected_ss),
<span class="lineNum">    1707 </span>            :                    StringStreamToString(&amp;actual_ss),
<span class="lineNum">    1708 </span>            :                    false);
<span class="lineNum">    1709 </span>            : }
<span class="lineNum">    1710 </span>            : 
<span class="lineNum">    1711 </span>            : // Helper function for implementing ASSERT_NEAR.
<span class="lineNum">    1712 </span>            : //
<span class="lineNum">    1713 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN A USER PROGRAM.
<span class="lineNum">    1714 </span>            : GTEST_API_ AssertionResult DoubleNearPredFormat(const char* expr1,
<span class="lineNum">    1715 </span>            :                                                 const char* expr2,
<span class="lineNum">    1716 </span>            :                                                 const char* abs_error_expr,
<span class="lineNum">    1717 </span>            :                                                 double val1,
<span class="lineNum">    1718 </span>            :                                                 double val2,
<span class="lineNum">    1719 </span>            :                                                 double abs_error);
<span class="lineNum">    1720 </span>            : 
<span class="lineNum">    1721 </span>            : // INTERNAL IMPLEMENTATION - DO NOT USE IN USER CODE.
<span class="lineNum">    1722 </span>            : // A class that enables one to stream messages to assertion macros
<span class="lineNum">    1723 </span>            : class GTEST_API_ AssertHelper {
<span class="lineNum">    1724 </span>            :  public:
<span class="lineNum">    1725 </span>            :   // Constructor.
<span class="lineNum">    1726 </span>            :   AssertHelper(TestPartResult::Type type,
<span class="lineNum">    1727 </span>            :                const char* file,
<span class="lineNum">    1728 </span>            :                int line,
<span class="lineNum">    1729 </span>            :                const char* message);
<span class="lineNum">    1730 </span>            :   ~AssertHelper();
<span class="lineNum">    1731 </span>            : 
<span class="lineNum">    1732 </span>            :   // Message assignment is a semantic trick to enable assertion
<span class="lineNum">    1733 </span>            :   // streaming; see the GTEST_MESSAGE_ macro below.
<span class="lineNum">    1734 </span>            :   void operator=(const Message&amp; message) const;
<span class="lineNum">    1735 </span>            : 
<span class="lineNum">    1736 </span>            :  private:
<span class="lineNum">    1737 </span>            :   // We put our data in a struct so that the size of the AssertHelper class can
<span class="lineNum">    1738 </span>            :   // be as small as possible.  This is important because gcc is incapable of
<a name="1739"><span class="lineNum">    1739 </span>            :   // re-using stack space even for temporary variables, so every EXPECT_EQ</a>
<a name="1740"><span class="lineNum">    1740 </span>            :   // reserves stack space for another AssertHelper.</a>
<span class="lineNum">    1741 </span><span class="lineNoCov">          0 :   struct AssertHelperData {</span>
<span class="lineNum">    1742 </span><span class="lineNoCov">          0 :     AssertHelperData(TestPartResult::Type t,</span>
<span class="lineNum">    1743 </span>            :                      const char* srcfile,
<span class="lineNum">    1744 </span>            :                      int line_num,
<span class="lineNum">    1745 </span>            :                      const char* msg)
<span class="lineNum">    1746 </span><span class="lineNoCov">          0 :         : type(t), file(srcfile), line(line_num), message(msg) { }</span>
<span class="lineNum">    1747 </span>            : 
<span class="lineNum">    1748 </span>            :     TestPartResult::Type const type;
<span class="lineNum">    1749 </span>            :     const char* const file;
<span class="lineNum">    1750 </span>            :     int const line;
<span class="lineNum">    1751 </span>            :     std::string const message;
<span class="lineNum">    1752 </span>            : 
<span class="lineNum">    1753 </span>            :    private:
<span class="lineNum">    1754 </span>            :     GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelperData);
<span class="lineNum">    1755 </span>            :   };
<span class="lineNum">    1756 </span>            : 
<span class="lineNum">    1757 </span>            :   AssertHelperData* const data_;
<span class="lineNum">    1758 </span>            : 
<span class="lineNum">    1759 </span>            :   GTEST_DISALLOW_COPY_AND_ASSIGN_(AssertHelper);
<span class="lineNum">    1760 </span>            : };
<span class="lineNum">    1761 </span>            : 
<span class="lineNum">    1762 </span>            : }  // namespace internal
<span class="lineNum">    1763 </span>            : 
<span class="lineNum">    1764 </span>            : #if GTEST_HAS_PARAM_TEST
<span class="lineNum">    1765 </span>            : // The pure interface class that all value-parameterized tests inherit from.
<span class="lineNum">    1766 </span>            : // A value-parameterized class must inherit from both ::testing::Test and
<span class="lineNum">    1767 </span>            : // ::testing::WithParamInterface. In most cases that just means inheriting
<span class="lineNum">    1768 </span>            : // from ::testing::TestWithParam, but more complicated test hierarchies
<span class="lineNum">    1769 </span>            : // may need to inherit from Test and WithParamInterface at different levels.
<span class="lineNum">    1770 </span>            : //
<span class="lineNum">    1771 </span>            : // This interface has support for accessing the test parameter value via
<span class="lineNum">    1772 </span>            : // the GetParam() method.
<span class="lineNum">    1773 </span>            : //
<span class="lineNum">    1774 </span>            : // Use it with one of the parameter generator defining functions, like Range(),
<span class="lineNum">    1775 </span>            : // Values(), ValuesIn(), Bool(), and Combine().
<span class="lineNum">    1776 </span>            : //
<span class="lineNum">    1777 </span>            : // class FooTest : public ::testing::TestWithParam&lt;int&gt; {
<span class="lineNum">    1778 </span>            : //  protected:
<span class="lineNum">    1779 </span>            : //   FooTest() {
<span class="lineNum">    1780 </span>            : //     // Can use GetParam() here.
<span class="lineNum">    1781 </span>            : //   }
<span class="lineNum">    1782 </span>            : //   virtual ~FooTest() {
<span class="lineNum">    1783 </span>            : //     // Can use GetParam() here.
<span class="lineNum">    1784 </span>            : //   }
<span class="lineNum">    1785 </span>            : //   virtual void SetUp() {
<span class="lineNum">    1786 </span>            : //     // Can use GetParam() here.
<span class="lineNum">    1787 </span>            : //   }
<span class="lineNum">    1788 </span>            : //   virtual void TearDown {
<span class="lineNum">    1789 </span>            : //     // Can use GetParam() here.
<span class="lineNum">    1790 </span>            : //   }
<span class="lineNum">    1791 </span>            : // };
<span class="lineNum">    1792 </span>            : // TEST_P(FooTest, DoesBar) {
<span class="lineNum">    1793 </span>            : //   // Can use GetParam() method here.
<span class="lineNum">    1794 </span>            : //   Foo foo;
<span class="lineNum">    1795 </span>            : //   ASSERT_TRUE(foo.DoesBar(GetParam()));
<span class="lineNum">    1796 </span>            : // }
<span class="lineNum">    1797 </span>            : // INSTANTIATE_TEST_CASE_P(OneToTenRange, FooTest, ::testing::Range(1, 10));
<span class="lineNum">    1798 </span>            : 
<span class="lineNum">    1799 </span>            : template &lt;typename T&gt;
<span class="lineNum">    1800 </span>            : class WithParamInterface {
<span class="lineNum">    1801 </span>            :  public:
<span class="lineNum">    1802 </span>            :   typedef T ParamType;
<span class="lineNum">    1803 </span>            :   virtual ~WithParamInterface() {}
<span class="lineNum">    1804 </span>            : 
<span class="lineNum">    1805 </span>            :   // The current parameter value. Is also available in the test fixture's
<span class="lineNum">    1806 </span>            :   // constructor. This member function is non-static, even though it only
<span class="lineNum">    1807 </span>            :   // references static data, to reduce the opportunity for incorrect uses
<span class="lineNum">    1808 </span>            :   // like writing 'WithParamInterface&lt;bool&gt;::GetParam()' for a test that
<span class="lineNum">    1809 </span>            :   // uses a fixture whose parameter type is int.
<span class="lineNum">    1810 </span>            :   const ParamType&amp; GetParam() const {
<span class="lineNum">    1811 </span>            :     GTEST_CHECK_(parameter_ != NULL)
<span class="lineNum">    1812 </span>            :         &lt;&lt; &quot;GetParam() can only be called inside a value-parameterized test &quot;
<span class="lineNum">    1813 </span>            :         &lt;&lt; &quot;-- did you intend to write TEST_P instead of TEST_F?&quot;;
<span class="lineNum">    1814 </span>            :     return *parameter_;
<span class="lineNum">    1815 </span>            :   }
<span class="lineNum">    1816 </span>            : 
<span class="lineNum">    1817 </span>            :  private:
<span class="lineNum">    1818 </span>            :   // Sets parameter value. The caller is responsible for making sure the value
<span class="lineNum">    1819 </span>            :   // remains alive and unchanged throughout the current test.
<span class="lineNum">    1820 </span>            :   static void SetParam(const ParamType* parameter) {
<span class="lineNum">    1821 </span>            :     parameter_ = parameter;
<span class="lineNum">    1822 </span>            :   }
<span class="lineNum">    1823 </span>            : 
<span class="lineNum">    1824 </span>            :   // Static value used for accessing parameter during a test lifetime.
<span class="lineNum">    1825 </span>            :   static const ParamType* parameter_;
<span class="lineNum">    1826 </span>            : 
<span class="lineNum">    1827 </span>            :   // TestClass must be a subclass of WithParamInterface&lt;T&gt; and Test.
<span class="lineNum">    1828 </span>            :   template &lt;class TestClass&gt; friend class internal::ParameterizedTestFactory;
<span class="lineNum">    1829 </span>            : };
<span class="lineNum">    1830 </span>            : 
<span class="lineNum">    1831 </span>            : template &lt;typename T&gt;
<span class="lineNum">    1832 </span>            : const T* WithParamInterface&lt;T&gt;::parameter_ = NULL;
<span class="lineNum">    1833 </span>            : 
<span class="lineNum">    1834 </span>            : // Most value-parameterized classes can ignore the existence of
<span class="lineNum">    1835 </span>            : // WithParamInterface, and can just inherit from ::testing::TestWithParam.
<span class="lineNum">    1836 </span>            : 
<span class="lineNum">    1837 </span>            : template &lt;typename T&gt;
<span class="lineNum">    1838 </span>            : class TestWithParam : public Test, public WithParamInterface&lt;T&gt; {
<span class="lineNum">    1839 </span>            : };
<span class="lineNum">    1840 </span>            : 
<span class="lineNum">    1841 </span>            : #endif  // GTEST_HAS_PARAM_TEST
<span class="lineNum">    1842 </span>            : 
<span class="lineNum">    1843 </span>            : // Macros for indicating success/failure in test code.
<span class="lineNum">    1844 </span>            : 
<span class="lineNum">    1845 </span>            : // ADD_FAILURE unconditionally adds a failure to the current test.
<span class="lineNum">    1846 </span>            : // SUCCEED generates a success - it doesn't automatically make the
<span class="lineNum">    1847 </span>            : // current test successful, as a test is only successful when it has
<span class="lineNum">    1848 </span>            : // no failure.
<span class="lineNum">    1849 </span>            : //
<span class="lineNum">    1850 </span>            : // EXPECT_* verifies that a certain condition is satisfied.  If not,
<span class="lineNum">    1851 </span>            : // it behaves like ADD_FAILURE.  In particular:
<span class="lineNum">    1852 </span>            : //
<span class="lineNum">    1853 </span>            : //   EXPECT_TRUE  verifies that a Boolean condition is true.
<span class="lineNum">    1854 </span>            : //   EXPECT_FALSE verifies that a Boolean condition is false.
<span class="lineNum">    1855 </span>            : //
<span class="lineNum">    1856 </span>            : // FAIL and ASSERT_* are similar to ADD_FAILURE and EXPECT_*, except
<span class="lineNum">    1857 </span>            : // that they will also abort the current function on failure.  People
<span class="lineNum">    1858 </span>            : // usually want the fail-fast behavior of FAIL and ASSERT_*, but those
<span class="lineNum">    1859 </span>            : // writing data-driven tests often find themselves using ADD_FAILURE
<span class="lineNum">    1860 </span>            : // and EXPECT_* more.
<span class="lineNum">    1861 </span>            : 
<span class="lineNum">    1862 </span>            : // Generates a nonfatal failure with a generic message.
<span class="lineNum">    1863 </span>            : #define ADD_FAILURE() GTEST_NONFATAL_FAILURE_(&quot;Failed&quot;)
<span class="lineNum">    1864 </span>            : 
<span class="lineNum">    1865 </span>            : // Generates a nonfatal failure at the given source file location with
<span class="lineNum">    1866 </span>            : // a generic message.
<span class="lineNum">    1867 </span>            : #define ADD_FAILURE_AT(file, line) \
<span class="lineNum">    1868 </span>            :   GTEST_MESSAGE_AT_(file, line, &quot;Failed&quot;, \
<span class="lineNum">    1869 </span>            :                     ::testing::TestPartResult::kNonFatalFailure)
<span class="lineNum">    1870 </span>            : 
<span class="lineNum">    1871 </span>            : // Generates a fatal failure with a generic message.
<span class="lineNum">    1872 </span>            : #define GTEST_FAIL() GTEST_FATAL_FAILURE_(&quot;Failed&quot;)
<span class="lineNum">    1873 </span>            : 
<span class="lineNum">    1874 </span>            : // Define this macro to 1 to omit the definition of FAIL(), which is a
<span class="lineNum">    1875 </span>            : // generic name and clashes with some other libraries.
<span class="lineNum">    1876 </span>            : #if !GTEST_DONT_DEFINE_FAIL
<span class="lineNum">    1877 </span>            : # define FAIL() GTEST_FAIL()
<span class="lineNum">    1878 </span>            : #endif
<span class="lineNum">    1879 </span>            : 
<span class="lineNum">    1880 </span>            : // Generates a success with a generic message.
<span class="lineNum">    1881 </span>            : #define GTEST_SUCCEED() GTEST_SUCCESS_(&quot;Succeeded&quot;)
<span class="lineNum">    1882 </span>            : 
<span class="lineNum">    1883 </span>            : // Define this macro to 1 to omit the definition of SUCCEED(), which
<span class="lineNum">    1884 </span>            : // is a generic name and clashes with some other libraries.
<span class="lineNum">    1885 </span>            : #if !GTEST_DONT_DEFINE_SUCCEED
<span class="lineNum">    1886 </span>            : # define SUCCEED() GTEST_SUCCEED()
<span class="lineNum">    1887 </span>            : #endif
<span class="lineNum">    1888 </span>            : 
<span class="lineNum">    1889 </span>            : // Macros for testing exceptions.
<span class="lineNum">    1890 </span>            : //
<span class="lineNum">    1891 </span>            : //    * {ASSERT|EXPECT}_THROW(statement, expected_exception):
<span class="lineNum">    1892 </span>            : //         Tests that the statement throws the expected exception.
<span class="lineNum">    1893 </span>            : //    * {ASSERT|EXPECT}_NO_THROW(statement):
<span class="lineNum">    1894 </span>            : //         Tests that the statement doesn't throw any exception.
<span class="lineNum">    1895 </span>            : //    * {ASSERT|EXPECT}_ANY_THROW(statement):
<span class="lineNum">    1896 </span>            : //         Tests that the statement throws an exception.
<span class="lineNum">    1897 </span>            : 
<span class="lineNum">    1898 </span>            : #define EXPECT_THROW(statement, expected_exception) \
<span class="lineNum">    1899 </span>            :   GTEST_TEST_THROW_(statement, expected_exception, GTEST_NONFATAL_FAILURE_)
<span class="lineNum">    1900 </span>            : #define EXPECT_NO_THROW(statement) \
<span class="lineNum">    1901 </span>            :   GTEST_TEST_NO_THROW_(statement, GTEST_NONFATAL_FAILURE_)
<span class="lineNum">    1902 </span>            : #define EXPECT_ANY_THROW(statement) \
<span class="lineNum">    1903 </span>            :   GTEST_TEST_ANY_THROW_(statement, GTEST_NONFATAL_FAILURE_)
<span class="lineNum">    1904 </span>            : #define ASSERT_THROW(statement, expected_exception) \
<span class="lineNum">    1905 </span>            :   GTEST_TEST_THROW_(statement, expected_exception, GTEST_FATAL_FAILURE_)
<span class="lineNum">    1906 </span>            : #define ASSERT_NO_THROW(statement) \
<span class="lineNum">    1907 </span>            :   GTEST_TEST_NO_THROW_(statement, GTEST_FATAL_FAILURE_)
<span class="lineNum">    1908 </span>            : #define ASSERT_ANY_THROW(statement) \
<span class="lineNum">    1909 </span>            :   GTEST_TEST_ANY_THROW_(statement, GTEST_FATAL_FAILURE_)
<span class="lineNum">    1910 </span>            : 
<span class="lineNum">    1911 </span>            : // Boolean assertions. Condition can be either a Boolean expression or an
<span class="lineNum">    1912 </span>            : // AssertionResult. For more information on how to use AssertionResult with
<span class="lineNum">    1913 </span>            : // these macros see comments on that class.
<span class="lineNum">    1914 </span>            : #define EXPECT_TRUE(condition) \
<span class="lineNum">    1915 </span>            :   GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
<span class="lineNum">    1916 </span>            :                       GTEST_NONFATAL_FAILURE_)
<span class="lineNum">    1917 </span>            : #define EXPECT_FALSE(condition) \
<span class="lineNum">    1918 </span>            :   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
<span class="lineNum">    1919 </span>            :                       GTEST_NONFATAL_FAILURE_)
<span class="lineNum">    1920 </span>            : #define ASSERT_TRUE(condition) \
<span class="lineNum">    1921 </span>            :   GTEST_TEST_BOOLEAN_(condition, #condition, false, true, \
<span class="lineNum">    1922 </span>            :                       GTEST_FATAL_FAILURE_)
<span class="lineNum">    1923 </span>            : #define ASSERT_FALSE(condition) \
<span class="lineNum">    1924 </span>            :   GTEST_TEST_BOOLEAN_(!(condition), #condition, true, false, \
<span class="lineNum">    1925 </span>            :                       GTEST_FATAL_FAILURE_)
<span class="lineNum">    1926 </span>            : 
<span class="lineNum">    1927 </span>            : // Includes the auto-generated header that implements a family of
<span class="lineNum">    1928 </span>            : // generic predicate assertion macros.
<span class="lineNum">    1929 </span>            : #include &quot;gtest/gtest_pred_impl.h&quot;
<span class="lineNum">    1930 </span>            : 
<span class="lineNum">    1931 </span>            : // Macros for testing equalities and inequalities.
<span class="lineNum">    1932 </span>            : //
<span class="lineNum">    1933 </span>            : //    * {ASSERT|EXPECT}_EQ(expected, actual): Tests that expected == actual
<span class="lineNum">    1934 </span>            : //    * {ASSERT|EXPECT}_NE(v1, v2):           Tests that v1 != v2
<span class="lineNum">    1935 </span>            : //    * {ASSERT|EXPECT}_LT(v1, v2):           Tests that v1 &lt; v2
<span class="lineNum">    1936 </span>            : //    * {ASSERT|EXPECT}_LE(v1, v2):           Tests that v1 &lt;= v2
<span class="lineNum">    1937 </span>            : //    * {ASSERT|EXPECT}_GT(v1, v2):           Tests that v1 &gt; v2
<span class="lineNum">    1938 </span>            : //    * {ASSERT|EXPECT}_GE(v1, v2):           Tests that v1 &gt;= v2
<span class="lineNum">    1939 </span>            : //
<span class="lineNum">    1940 </span>            : // When they are not, Google Test prints both the tested expressions and
<span class="lineNum">    1941 </span>            : // their actual values.  The values must be compatible built-in types,
<span class="lineNum">    1942 </span>            : // or you will get a compiler error.  By &quot;compatible&quot; we mean that the
<span class="lineNum">    1943 </span>            : // values can be compared by the respective operator.
<span class="lineNum">    1944 </span>            : //
<span class="lineNum">    1945 </span>            : // Note:
<span class="lineNum">    1946 </span>            : //
<span class="lineNum">    1947 </span>            : //   1. It is possible to make a user-defined type work with
<span class="lineNum">    1948 </span>            : //   {ASSERT|EXPECT}_??(), but that requires overloading the
<span class="lineNum">    1949 </span>            : //   comparison operators and is thus discouraged by the Google C++
<span class="lineNum">    1950 </span>            : //   Usage Guide.  Therefore, you are advised to use the
<span class="lineNum">    1951 </span>            : //   {ASSERT|EXPECT}_TRUE() macro to assert that two objects are
<span class="lineNum">    1952 </span>            : //   equal.
<span class="lineNum">    1953 </span>            : //
<span class="lineNum">    1954 </span>            : //   2. The {ASSERT|EXPECT}_??() macros do pointer comparisons on
<span class="lineNum">    1955 </span>            : //   pointers (in particular, C strings).  Therefore, if you use it
<span class="lineNum">    1956 </span>            : //   with two C strings, you are testing how their locations in memory
<span class="lineNum">    1957 </span>            : //   are related, not how their content is related.  To compare two C
<span class="lineNum">    1958 </span>            : //   strings by content, use {ASSERT|EXPECT}_STR*().
<span class="lineNum">    1959 </span>            : //
<span class="lineNum">    1960 </span>            : //   3. {ASSERT|EXPECT}_EQ(expected, actual) is preferred to
<span class="lineNum">    1961 </span>            : //   {ASSERT|EXPECT}_TRUE(expected == actual), as the former tells you
<span class="lineNum">    1962 </span>            : //   what the actual value is when it fails, and similarly for the
<span class="lineNum">    1963 </span>            : //   other comparisons.
<span class="lineNum">    1964 </span>            : //
<span class="lineNum">    1965 </span>            : //   4. Do not depend on the order in which {ASSERT|EXPECT}_??()
<span class="lineNum">    1966 </span>            : //   evaluate their arguments, which is undefined.
<span class="lineNum">    1967 </span>            : //
<span class="lineNum">    1968 </span>            : //   5. These macros evaluate their arguments exactly once.
<span class="lineNum">    1969 </span>            : //
<span class="lineNum">    1970 </span>            : // Examples:
<span class="lineNum">    1971 </span>            : //
<span class="lineNum">    1972 </span>            : //   EXPECT_NE(5, Foo());
<span class="lineNum">    1973 </span>            : //   EXPECT_EQ(NULL, a_pointer);
<span class="lineNum">    1974 </span>            : //   ASSERT_LT(i, array_size);
<span class="lineNum">    1975 </span>            : //   ASSERT_GT(records.size(), 0) &lt;&lt; &quot;There is no record left.&quot;;
<span class="lineNum">    1976 </span>            : 
<span class="lineNum">    1977 </span>            : #define EXPECT_EQ(expected, actual) \
<span class="lineNum">    1978 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal:: \
<span class="lineNum">    1979 </span>            :                       EqHelper&lt;GTEST_IS_NULL_LITERAL_(expected)&gt;::Compare, \
<span class="lineNum">    1980 </span>            :                       expected, actual)
<span class="lineNum">    1981 </span>            : #define EXPECT_NE(expected, actual) \
<span class="lineNum">    1982 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperNE, expected, actual)
<span class="lineNum">    1983 </span>            : #define EXPECT_LE(val1, val2) \
<span class="lineNum">    1984 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
<span class="lineNum">    1985 </span>            : #define EXPECT_LT(val1, val2) \
<span class="lineNum">    1986 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
<span class="lineNum">    1987 </span>            : #define EXPECT_GE(val1, val2) \
<span class="lineNum">    1988 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
<span class="lineNum">    1989 </span>            : #define EXPECT_GT(val1, val2) \
<span class="lineNum">    1990 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
<span class="lineNum">    1991 </span>            : 
<span class="lineNum">    1992 </span>            : #define GTEST_ASSERT_EQ(expected, actual) \
<span class="lineNum">    1993 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal:: \
<span class="lineNum">    1994 </span>            :                       EqHelper&lt;GTEST_IS_NULL_LITERAL_(expected)&gt;::Compare, \
<span class="lineNum">    1995 </span>            :                       expected, actual)
<span class="lineNum">    1996 </span>            : #define GTEST_ASSERT_NE(val1, val2) \
<span class="lineNum">    1997 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperNE, val1, val2)
<span class="lineNum">    1998 </span>            : #define GTEST_ASSERT_LE(val1, val2) \
<span class="lineNum">    1999 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLE, val1, val2)
<span class="lineNum">    2000 </span>            : #define GTEST_ASSERT_LT(val1, val2) \
<span class="lineNum">    2001 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperLT, val1, val2)
<span class="lineNum">    2002 </span>            : #define GTEST_ASSERT_GE(val1, val2) \
<span class="lineNum">    2003 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGE, val1, val2)
<span class="lineNum">    2004 </span>            : #define GTEST_ASSERT_GT(val1, val2) \
<span class="lineNum">    2005 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperGT, val1, val2)
<span class="lineNum">    2006 </span>            : 
<span class="lineNum">    2007 </span>            : // Define macro GTEST_DONT_DEFINE_ASSERT_XY to 1 to omit the definition of
<span class="lineNum">    2008 </span>            : // ASSERT_XY(), which clashes with some users' own code.
<span class="lineNum">    2009 </span>            : 
<span class="lineNum">    2010 </span>            : #if !GTEST_DONT_DEFINE_ASSERT_EQ
<span class="lineNum">    2011 </span>            : # define ASSERT_EQ(val1, val2) GTEST_ASSERT_EQ(val1, val2)
<span class="lineNum">    2012 </span>            : #endif
<span class="lineNum">    2013 </span>            : 
<span class="lineNum">    2014 </span>            : #if !GTEST_DONT_DEFINE_ASSERT_NE
<span class="lineNum">    2015 </span>            : # define ASSERT_NE(val1, val2) GTEST_ASSERT_NE(val1, val2)
<span class="lineNum">    2016 </span>            : #endif
<span class="lineNum">    2017 </span>            : 
<span class="lineNum">    2018 </span>            : #if !GTEST_DONT_DEFINE_ASSERT_LE
<span class="lineNum">    2019 </span>            : # define ASSERT_LE(val1, val2) GTEST_ASSERT_LE(val1, val2)
<span class="lineNum">    2020 </span>            : #endif
<span class="lineNum">    2021 </span>            : 
<span class="lineNum">    2022 </span>            : #if !GTEST_DONT_DEFINE_ASSERT_LT
<span class="lineNum">    2023 </span>            : # define ASSERT_LT(val1, val2) GTEST_ASSERT_LT(val1, val2)
<span class="lineNum">    2024 </span>            : #endif
<span class="lineNum">    2025 </span>            : 
<span class="lineNum">    2026 </span>            : #if !GTEST_DONT_DEFINE_ASSERT_GE
<span class="lineNum">    2027 </span>            : # define ASSERT_GE(val1, val2) GTEST_ASSERT_GE(val1, val2)
<span class="lineNum">    2028 </span>            : #endif
<span class="lineNum">    2029 </span>            : 
<span class="lineNum">    2030 </span>            : #if !GTEST_DONT_DEFINE_ASSERT_GT
<span class="lineNum">    2031 </span>            : # define ASSERT_GT(val1, val2) GTEST_ASSERT_GT(val1, val2)
<span class="lineNum">    2032 </span>            : #endif
<span class="lineNum">    2033 </span>            : 
<span class="lineNum">    2034 </span>            : // C-string Comparisons.  All tests treat NULL and any non-NULL string
<span class="lineNum">    2035 </span>            : // as different.  Two NULLs are equal.
<span class="lineNum">    2036 </span>            : //
<span class="lineNum">    2037 </span>            : //    * {ASSERT|EXPECT}_STREQ(s1, s2):     Tests that s1 == s2
<span class="lineNum">    2038 </span>            : //    * {ASSERT|EXPECT}_STRNE(s1, s2):     Tests that s1 != s2
<span class="lineNum">    2039 </span>            : //    * {ASSERT|EXPECT}_STRCASEEQ(s1, s2): Tests that s1 == s2, ignoring case
<span class="lineNum">    2040 </span>            : //    * {ASSERT|EXPECT}_STRCASENE(s1, s2): Tests that s1 != s2, ignoring case
<span class="lineNum">    2041 </span>            : //
<span class="lineNum">    2042 </span>            : // For wide or narrow string objects, you can use the
<span class="lineNum">    2043 </span>            : // {ASSERT|EXPECT}_??() macros.
<span class="lineNum">    2044 </span>            : //
<span class="lineNum">    2045 </span>            : // Don't depend on the order in which the arguments are evaluated,
<span class="lineNum">    2046 </span>            : // which is undefined.
<span class="lineNum">    2047 </span>            : //
<span class="lineNum">    2048 </span>            : // These macros evaluate their arguments exactly once.
<span class="lineNum">    2049 </span>            : 
<span class="lineNum">    2050 </span>            : #define EXPECT_STREQ(expected, actual) \
<span class="lineNum">    2051 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
<span class="lineNum">    2052 </span>            : #define EXPECT_STRNE(s1, s2) \
<span class="lineNum">    2053 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
<span class="lineNum">    2054 </span>            : #define EXPECT_STRCASEEQ(expected, actual) \
<span class="lineNum">    2055 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
<span class="lineNum">    2056 </span>            : #define EXPECT_STRCASENE(s1, s2)\
<span class="lineNum">    2057 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
<span class="lineNum">    2058 </span>            : 
<span class="lineNum">    2059 </span>            : #define ASSERT_STREQ(expected, actual) \
<span class="lineNum">    2060 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTREQ, expected, actual)
<span class="lineNum">    2061 </span>            : #define ASSERT_STRNE(s1, s2) \
<span class="lineNum">    2062 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRNE, s1, s2)
<span class="lineNum">    2063 </span>            : #define ASSERT_STRCASEEQ(expected, actual) \
<span class="lineNum">    2064 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASEEQ, expected, actual)
<span class="lineNum">    2065 </span>            : #define ASSERT_STRCASENE(s1, s2)\
<span class="lineNum">    2066 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSTRCASENE, s1, s2)
<span class="lineNum">    2067 </span>            : 
<span class="lineNum">    2068 </span>            : // Macros for comparing floating-point numbers.
<span class="lineNum">    2069 </span>            : //
<span class="lineNum">    2070 </span>            : //    * {ASSERT|EXPECT}_FLOAT_EQ(expected, actual):
<span class="lineNum">    2071 </span>            : //         Tests that two float values are almost equal.
<span class="lineNum">    2072 </span>            : //    * {ASSERT|EXPECT}_DOUBLE_EQ(expected, actual):
<span class="lineNum">    2073 </span>            : //         Tests that two double values are almost equal.
<span class="lineNum">    2074 </span>            : //    * {ASSERT|EXPECT}_NEAR(v1, v2, abs_error):
<span class="lineNum">    2075 </span>            : //         Tests that v1 and v2 are within the given distance to each other.
<span class="lineNum">    2076 </span>            : //
<span class="lineNum">    2077 </span>            : // Google Test uses ULP-based comparison to automatically pick a default
<span class="lineNum">    2078 </span>            : // error bound that is appropriate for the operands.  See the
<span class="lineNum">    2079 </span>            : // FloatingPoint template class in gtest-internal.h if you are
<span class="lineNum">    2080 </span>            : // interested in the implementation details.
<span class="lineNum">    2081 </span>            : 
<span class="lineNum">    2082 </span>            : #define EXPECT_FLOAT_EQ(expected, actual)\
<span class="lineNum">    2083 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ&lt;float&gt;, \
<span class="lineNum">    2084 </span>            :                       expected, actual)
<span class="lineNum">    2085 </span>            : 
<span class="lineNum">    2086 </span>            : #define EXPECT_DOUBLE_EQ(expected, actual)\
<span class="lineNum">    2087 </span>            :   EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ&lt;double&gt;, \
<span class="lineNum">    2088 </span>            :                       expected, actual)
<span class="lineNum">    2089 </span>            : 
<span class="lineNum">    2090 </span>            : #define ASSERT_FLOAT_EQ(expected, actual)\
<span class="lineNum">    2091 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ&lt;float&gt;, \
<span class="lineNum">    2092 </span>            :                       expected, actual)
<span class="lineNum">    2093 </span>            : 
<span class="lineNum">    2094 </span>            : #define ASSERT_DOUBLE_EQ(expected, actual)\
<span class="lineNum">    2095 </span>            :   ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ&lt;double&gt;, \
<span class="lineNum">    2096 </span>            :                       expected, actual)
<span class="lineNum">    2097 </span>            : 
<span class="lineNum">    2098 </span>            : #define EXPECT_NEAR(val1, val2, abs_error)\
<span class="lineNum">    2099 </span>            :   EXPECT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
<span class="lineNum">    2100 </span>            :                       val1, val2, abs_error)
<span class="lineNum">    2101 </span>            : 
<span class="lineNum">    2102 </span>            : #define ASSERT_NEAR(val1, val2, abs_error)\
<span class="lineNum">    2103 </span>            :   ASSERT_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
<span class="lineNum">    2104 </span>            :                       val1, val2, abs_error)
<span class="lineNum">    2105 </span>            : 
<span class="lineNum">    2106 </span>            : // These predicate format functions work on floating-point values, and
<span class="lineNum">    2107 </span>            : // can be used in {ASSERT|EXPECT}_PRED_FORMAT2*(), e.g.
<span class="lineNum">    2108 </span>            : //
<span class="lineNum">    2109 </span>            : //   EXPECT_PRED_FORMAT2(testing::DoubleLE, Foo(), 5.0);
<span class="lineNum">    2110 </span>            : 
<span class="lineNum">    2111 </span>            : // Asserts that val1 is less than, or almost equal to, val2.  Fails
<span class="lineNum">    2112 </span>            : // otherwise.  In particular, it fails if either val1 or val2 is NaN.
<span class="lineNum">    2113 </span>            : GTEST_API_ AssertionResult FloatLE(const char* expr1, const char* expr2,
<span class="lineNum">    2114 </span>            :                                    float val1, float val2);
<span class="lineNum">    2115 </span>            : GTEST_API_ AssertionResult DoubleLE(const char* expr1, const char* expr2,
<span class="lineNum">    2116 </span>            :                                     double val1, double val2);
<span class="lineNum">    2117 </span>            : 
<span class="lineNum">    2118 </span>            : 
<span class="lineNum">    2119 </span>            : #if GTEST_OS_WINDOWS
<span class="lineNum">    2120 </span>            : 
<span class="lineNum">    2121 </span>            : // Macros that test for HRESULT failure and success, these are only useful
<span class="lineNum">    2122 </span>            : // on Windows, and rely on Windows SDK macros and APIs to compile.
<span class="lineNum">    2123 </span>            : //
<span class="lineNum">    2124 </span>            : //    * {ASSERT|EXPECT}_HRESULT_{SUCCEEDED|FAILED}(expr)
<span class="lineNum">    2125 </span>            : //
<span class="lineNum">    2126 </span>            : // When expr unexpectedly fails or succeeds, Google Test prints the
<span class="lineNum">    2127 </span>            : // expected result and the actual result with both a human-readable
<span class="lineNum">    2128 </span>            : // string representation of the error, if available, as well as the
<span class="lineNum">    2129 </span>            : // hex result code.
<span class="lineNum">    2130 </span>            : # define EXPECT_HRESULT_SUCCEEDED(expr) \
<span class="lineNum">    2131 </span>            :     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
<span class="lineNum">    2132 </span>            : 
<span class="lineNum">    2133 </span>            : # define ASSERT_HRESULT_SUCCEEDED(expr) \
<span class="lineNum">    2134 </span>            :     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTSuccess, (expr))
<span class="lineNum">    2135 </span>            : 
<span class="lineNum">    2136 </span>            : # define EXPECT_HRESULT_FAILED(expr) \
<span class="lineNum">    2137 </span>            :     EXPECT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
<span class="lineNum">    2138 </span>            : 
<span class="lineNum">    2139 </span>            : # define ASSERT_HRESULT_FAILED(expr) \
<span class="lineNum">    2140 </span>            :     ASSERT_PRED_FORMAT1(::testing::internal::IsHRESULTFailure, (expr))
<span class="lineNum">    2141 </span>            : 
<span class="lineNum">    2142 </span>            : #endif  // GTEST_OS_WINDOWS
<span class="lineNum">    2143 </span>            : 
<span class="lineNum">    2144 </span>            : // Macros that execute statement and check that it doesn't generate new fatal
<span class="lineNum">    2145 </span>            : // failures in the current thread.
<span class="lineNum">    2146 </span>            : //
<span class="lineNum">    2147 </span>            : //   * {ASSERT|EXPECT}_NO_FATAL_FAILURE(statement);
<span class="lineNum">    2148 </span>            : //
<span class="lineNum">    2149 </span>            : // Examples:
<span class="lineNum">    2150 </span>            : //
<span class="lineNum">    2151 </span>            : //   EXPECT_NO_FATAL_FAILURE(Process());
<span class="lineNum">    2152 </span>            : //   ASSERT_NO_FATAL_FAILURE(Process()) &lt;&lt; &quot;Process() failed&quot;;
<span class="lineNum">    2153 </span>            : //
<span class="lineNum">    2154 </span>            : #define ASSERT_NO_FATAL_FAILURE(statement) \
<span class="lineNum">    2155 </span>            :     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_FATAL_FAILURE_)
<span class="lineNum">    2156 </span>            : #define EXPECT_NO_FATAL_FAILURE(statement) \
<span class="lineNum">    2157 </span>            :     GTEST_TEST_NO_FATAL_FAILURE_(statement, GTEST_NONFATAL_FAILURE_)
<span class="lineNum">    2158 </span>            : 
<span class="lineNum">    2159 </span>            : // Causes a trace (including the source file path, the current line
<span class="lineNum">    2160 </span>            : // number, and the given message) to be included in every test failure
<span class="lineNum">    2161 </span>            : // message generated by code in the current scope.  The effect is
<span class="lineNum">    2162 </span>            : // undone when the control leaves the current scope.
<span class="lineNum">    2163 </span>            : //
<span class="lineNum">    2164 </span>            : // The message argument can be anything streamable to std::ostream.
<span class="lineNum">    2165 </span>            : //
<span class="lineNum">    2166 </span>            : // In the implementation, we include the current line number as part
<span class="lineNum">    2167 </span>            : // of the dummy variable name, thus allowing multiple SCOPED_TRACE()s
<span class="lineNum">    2168 </span>            : // to appear in the same block - as long as they are on different
<span class="lineNum">    2169 </span>            : // lines.
<span class="lineNum">    2170 </span>            : #define SCOPED_TRACE(message) \
<span class="lineNum">    2171 </span>            :   ::testing::internal::ScopedTrace GTEST_CONCAT_TOKEN_(gtest_trace_, __LINE__)(\
<span class="lineNum">    2172 </span>            :     __FILE__, __LINE__, ::testing::Message() &lt;&lt; (message))
<span class="lineNum">    2173 </span>            : 
<span class="lineNum">    2174 </span>            : // Compile-time assertion for type equality.
<span class="lineNum">    2175 </span>            : // StaticAssertTypeEq&lt;type1, type2&gt;() compiles iff type1 and type2 are
<span class="lineNum">    2176 </span>            : // the same type.  The value it returns is not interesting.
<span class="lineNum">    2177 </span>            : //
<span class="lineNum">    2178 </span>            : // Instead of making StaticAssertTypeEq a class template, we make it a
<span class="lineNum">    2179 </span>            : // function template that invokes a helper class template.  This
<span class="lineNum">    2180 </span>            : // prevents a user from misusing StaticAssertTypeEq&lt;T1, T2&gt; by
<span class="lineNum">    2181 </span>            : // defining objects of that type.
<span class="lineNum">    2182 </span>            : //
<span class="lineNum">    2183 </span>            : // CAVEAT:
<span class="lineNum">    2184 </span>            : //
<span class="lineNum">    2185 </span>            : // When used inside a method of a class template,
<span class="lineNum">    2186 </span>            : // StaticAssertTypeEq&lt;T1, T2&gt;() is effective ONLY IF the method is
<span class="lineNum">    2187 </span>            : // instantiated.  For example, given:
<span class="lineNum">    2188 </span>            : //
<span class="lineNum">    2189 </span>            : //   template &lt;typename T&gt; class Foo {
<span class="lineNum">    2190 </span>            : //    public:
<span class="lineNum">    2191 </span>            : //     void Bar() { testing::StaticAssertTypeEq&lt;int, T&gt;(); }
<span class="lineNum">    2192 </span>            : //   };
<span class="lineNum">    2193 </span>            : //
<span class="lineNum">    2194 </span>            : // the code:
<span class="lineNum">    2195 </span>            : //
<span class="lineNum">    2196 </span>            : //   void Test1() { Foo&lt;bool&gt; foo; }
<span class="lineNum">    2197 </span>            : //
<span class="lineNum">    2198 </span>            : // will NOT generate a compiler error, as Foo&lt;bool&gt;::Bar() is never
<span class="lineNum">    2199 </span>            : // actually instantiated.  Instead, you need:
<span class="lineNum">    2200 </span>            : //
<span class="lineNum">    2201 </span>            : //   void Test2() { Foo&lt;bool&gt; foo; foo.Bar(); }
<span class="lineNum">    2202 </span>            : //
<span class="lineNum">    2203 </span>            : // to cause a compiler error.
<span class="lineNum">    2204 </span>            : template &lt;typename T1, typename T2&gt;
<span class="lineNum">    2205 </span>            : bool StaticAssertTypeEq() {
<span class="lineNum">    2206 </span>            :   (void)internal::StaticAssertTypeEqHelper&lt;T1, T2&gt;();
<span class="lineNum">    2207 </span>            :   return true;
<span class="lineNum">    2208 </span>            : }
<span class="lineNum">    2209 </span>            : 
<span class="lineNum">    2210 </span>            : // Defines a test.
<span class="lineNum">    2211 </span>            : //
<span class="lineNum">    2212 </span>            : // The first parameter is the name of the test case, and the second
<span class="lineNum">    2213 </span>            : // parameter is the name of the test within the test case.
<span class="lineNum">    2214 </span>            : //
<span class="lineNum">    2215 </span>            : // The convention is to end the test case name with &quot;Test&quot;.  For
<span class="lineNum">    2216 </span>            : // example, a test case for the Foo class can be named FooTest.
<span class="lineNum">    2217 </span>            : //
<span class="lineNum">    2218 </span>            : // The user should put his test code between braces after using this
<span class="lineNum">    2219 </span>            : // macro.  Example:
<span class="lineNum">    2220 </span>            : //
<span class="lineNum">    2221 </span>            : //   TEST(FooTest, InitializesCorrectly) {
<span class="lineNum">    2222 </span>            : //     Foo foo;
<span class="lineNum">    2223 </span>            : //     EXPECT_TRUE(foo.StatusIsOK());
<span class="lineNum">    2224 </span>            : //   }
<span class="lineNum">    2225 </span>            : 
<span class="lineNum">    2226 </span>            : // Note that we call GetTestTypeId() instead of GetTypeId&lt;
<span class="lineNum">    2227 </span>            : // ::testing::Test&gt;() here to get the type ID of testing::Test.  This
<span class="lineNum">    2228 </span>            : // is to work around a suspected linker bug when using Google Test as
<span class="lineNum">    2229 </span>            : // a framework on Mac OS X.  The bug causes GetTypeId&lt;
<span class="lineNum">    2230 </span>            : // ::testing::Test&gt;() to return different values depending on whether
<span class="lineNum">    2231 </span>            : // the call is from the Google Test framework itself or from user test
<span class="lineNum">    2232 </span>            : // code.  GetTestTypeId() is guaranteed to always return the same
<span class="lineNum">    2233 </span>            : // value, as it always calls GetTypeId&lt;&gt;() from the Google Test
<span class="lineNum">    2234 </span>            : // framework.
<span class="lineNum">    2235 </span>            : #define GTEST_TEST(test_case_name, test_name)\
<span class="lineNum">    2236 </span>            :   GTEST_TEST_(test_case_name, test_name, \
<span class="lineNum">    2237 </span>            :               ::testing::Test, ::testing::internal::GetTestTypeId())
<span class="lineNum">    2238 </span>            : 
<span class="lineNum">    2239 </span>            : // Define this macro to 1 to omit the definition of TEST(), which
<span class="lineNum">    2240 </span>            : // is a generic name and clashes with some other libraries.
<span class="lineNum">    2241 </span>            : #if !GTEST_DONT_DEFINE_TEST
<span class="lineNum">    2242 </span>            : # define TEST(test_case_name, test_name) GTEST_TEST(test_case_name, test_name)
<span class="lineNum">    2243 </span>            : #endif
<span class="lineNum">    2244 </span>            : 
<span class="lineNum">    2245 </span>            : // Defines a test that uses a test fixture.
<span class="lineNum">    2246 </span>            : //
<span class="lineNum">    2247 </span>            : // The first parameter is the name of the test fixture class, which
<span class="lineNum">    2248 </span>            : // also doubles as the test case name.  The second parameter is the
<span class="lineNum">    2249 </span>            : // name of the test within the test case.
<span class="lineNum">    2250 </span>            : //
<span class="lineNum">    2251 </span>            : // A test fixture class must be declared earlier.  The user should put
<span class="lineNum">    2252 </span>            : // his test code between braces after using this macro.  Example:
<span class="lineNum">    2253 </span>            : //
<span class="lineNum">    2254 </span>            : //   class FooTest : public testing::Test {
<span class="lineNum">    2255 </span>            : //    protected:
<span class="lineNum">    2256 </span>            : //     virtual void SetUp() { b_.AddElement(3); }
<span class="lineNum">    2257 </span>            : //
<span class="lineNum">    2258 </span>            : //     Foo a_;
<span class="lineNum">    2259 </span>            : //     Foo b_;
<span class="lineNum">    2260 </span>            : //   };
<span class="lineNum">    2261 </span>            : //
<span class="lineNum">    2262 </span>            : //   TEST_F(FooTest, InitializesCorrectly) {
<span class="lineNum">    2263 </span>            : //     EXPECT_TRUE(a_.StatusIsOK());
<span class="lineNum">    2264 </span>            : //   }
<span class="lineNum">    2265 </span>            : //
<span class="lineNum">    2266 </span>            : //   TEST_F(FooTest, ReturnsElementCountCorrectly) {
<span class="lineNum">    2267 </span>            : //     EXPECT_EQ(0, a_.size());
<span class="lineNum">    2268 </span>            : //     EXPECT_EQ(1, b_.size());
<span class="lineNum">    2269 </span>            : //   }
<span class="lineNum">    2270 </span>            : 
<span class="lineNum">    2271 </span>            : #define TEST_F(test_fixture, test_name)\
<span class="lineNum">    2272 </span>            :   GTEST_TEST_(test_fixture, test_name, test_fixture, \
<span class="lineNum">    2273 </span>            :               ::testing::internal::GetTypeId&lt;test_fixture&gt;())
<span class="lineNum">    2274 </span>            : 
<span class="lineNum">    2275 </span>            : }  // namespace testing
<span class="lineNum">    2276 </span>            : 
<span class="lineNum">    2277 </span>            : // Use this function in main() to run all tests.  It returns 0 if all
<span class="lineNum">    2278 </span>            : // tests are successful, or 1 otherwise.
<span class="lineNum">    2279 </span>            : //
<span class="lineNum">    2280 </span>            : // RUN_ALL_TESTS() should be invoked after the command line has been
<span class="lineNum">    2281 </span>            : // parsed by InitGoogleTest().
<span class="lineNum">    2282 </span>            : //
<span class="lineNum">    2283 </span>            : // This function was formerly a macro; thus, it is in the global
<span class="lineNum">    2284 </span>            : // namespace and has an all-caps name.
<a name="2285"><span class="lineNum">    2285 </span>            : int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_;</a>
<span class="lineNum">    2286 </span>            : 
<span class="lineNum">    2287 </span><span class="lineNoCov">          0 : inline int RUN_ALL_TESTS() {</span>
<span class="lineNum">    2288 </span><span class="lineNoCov">          0 :   return ::testing::UnitTest::GetInstance()-&gt;Run();</span>
<span class="lineNum">    2289 </span>            : }
<span class="lineNum">    2290 </span>            : 
<span class="lineNum">    2291 </span>            : #endif  // GTEST_INCLUDE_GTEST_GTEST_H_
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../../../../../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.11</a></td></tr>
  </table>
  <br>

</body>
</html>
